[system] / trunk / pg / macros / parserNumberWithUnits.pl Repository:
ViewVC logotype

Annotation of /trunk/pg/macros/parserNumberWithUnits.pl

Parent Directory Parent Directory | Revision Log Revision Log


Revision 5555 - (view) (download) (as text)

1 : sh002i 5553 =head1 NAME
2 : dpvc 2731
3 : sh002i 5553 parserNumberWithUnits.pl - Implements a number with units.
4 :    
5 : gage 4997 =head1 DESCRIPTION
6 :    
7 : sh002i 5553 This is a Parser class that implements a number with units.
8 :     It is a temporary version until the Parser can handle it
9 :     directly.
10 : dpvc 2731
11 : sh002i 5553 Use NumberWithUnits("num units") or NumberWithUnits(formula,"units")
12 :     to generate a NumberWithUnits object, and then call its cmp method
13 :     to get an answer checker for your number with units.
14 : gage 4997
15 : sh002i 5553 Usage examples:
16 :    
17 : sh002i 5555 ANS(NumberWithUnits("3 ft")->cmp);
18 :     ANS(NumberWithUnits("$a*$b ft")->cmp);
19 :     ANS(NumberWithUnits($a*$b,"ft")->cmp);
20 : sh002i 5553
21 :     We now call on the Legacy version, which is used by
22 :     num_cmp to handle numbers with units.
23 :    
24 : gage 4997 =cut
25 :    
26 : sh002i 5553 loadMacros('MathObjects.pl');
27 :    
28 : dpvc 5392 sub _parserNumberWithUnits_init {
29 :     main::PG_restricted_eval('sub NumberWithUnits {Parser::Legacy::NumberWithUnits->new(@_)}');
30 :     }
31 : dpvc 2731
32 :     1;

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9