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

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

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

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

Legend:
Removed from v.5392  
changed lines
  Added in v.5553

aubreyja at gmail dot com
ViewVC Help
Powered by ViewVC 1.0.9