12.4 A More Typical Object-Oriented Module: Math::BigInt


So as not to get dismayed about how "un-OO" the File::Spec module might be, let's look at yet another core module, Math::BigInt :

use Math::BigInt; my $value = Math::BigInt->new(2); # start with 2 $value->bpow(1000);               # take 2**1000 print $value->bstr(  ), "\n";       # print it out

Here, nothing is imported. The entire interface calls class methods such as new against the class name to create instances, and then calls instance methods against those instances.



Learning Perl Objects, References & Modules
Learning Perl Objects, References, and Modules
ISBN: 0596004788
EAN: 2147483647
Year: 2003
Pages: 199

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net