Learning Perl Objects, References & ModulesLearning Perl Objects, References & ModulesSearch this book

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.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.