|
NAMEMath::SimpleVariable - simple representation of mathematical variablesSYNOPSISuse Math::SimpleVariable; # Make a variable my $foo = new Math::SimpleVariable(name => 'foo', value => 0.3); # Some of the available accessors # Note that many are identical, but you might want to change # their behaviour in derived variable classes... my $name = $foo->name(); # yields 'foo' print $foo->stringify(), "\n"; # prints 'foo' my $id = $foo->id(); # yields 'foo' my $value = $foo->value(); # yields 0.3 print $foo->evaluate(), "\n"; # prints 0.3 # Make a second variable my $bar = $foo->clone(); $bar->{name} = 'bar'; # changes the name (and as a consequence the id()) print $bar->value(), "\n"; # prints the same value, 0.3 DESCRIPTIONMath::SimpleVariable is a simple representation of mathematical variables, with an obligatory name and an optional value. This class on itself might not seem very useful at first sight, but you might want to derive different types of variables for some application. That way, objects of the derived variable class can be accessed interchangeably with the here provided protocols.Math::SimpleVariable has two data fields - name and value - that can be accessed and modified as if the variable object is a hash. E.g. $var->{name} = 'foo'; sets the name of the object $var to 'foo', and my $val = $var->{value}; reads the value of the $var object into $val. In addition, the following accessor methods are available for Math::SimpleVariable objects:
SEE ALSOperl(1).VERSIONThis is CVS $Revision: 1.6 $ of Math::Simplevariable, last edited at $Date: 2001/10/31 12:38:39 $.AUTHORWim Verhaegen <wimv@cpan.org>COPYRIGHTCopyright (C) 2001 Wim Verhaegen. All rights reserved. This program is free software; you may redistribute and/or modify it under the same terms as Perl itself.
Visit the GSP FreeBSD Man Page Interface. |