Data::Formula - formulas evaluation and calculation
my $df = Data::Formula->new( formula => 'var212 - var213 * var314 + var354', ); my $val = $df->calculate( var212 => 5, var213 => 10, var314 => 7, var354 => 100 ); # 5-(10*7)+100 my $df = Data::Formula->new( variables => [qw( var212 var213 n274 n294 var314 var334 var354 var374 var394 )], formula => 'var212 - var213 + var314 * (var354 + var394) - 10', ); my $used_variables = $df->used_variables; # [ var212 var213 var314 var354 var394 ] my $val = $df->calculate( var212 => 5, var213 => 10, var314 => 2, var354 => 3, var394 => 9, ); # 5-10+2*(3+9)-10
evaluate and calulate formulas with variables of the type var212 - var213 + var314 * (var354 + var394) - 10
Object constructor.
my $df = Data::Formula->new( formula => 'var212 - var213 * var314 + var354', );
return array with variables used in formula
evaluate formula with values for variables, returns caluculated value
Jozef Kutej, <jkutej at cpan.org>
<jkutej at cpan.org>
The following people have contributed to the File::is by committing their code, sending patches, reporting bugs, asking questions, suggesting useful advises, nitpicking, chatting on IRC or commenting on my blog (in no particular order):
Andrea Pavlovic
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Data::Formula, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Formula
CPAN shell
perl -MCPAN -e shell install Data::Formula
For more information on module installation, please visit the detailed CPAN module installation guide.