3.6. A More Typical Object-Oriented Module: Math::BigIntSo as not to get dismayed about how "un-OO" the File::Spec module seems since it doesn't have objects, let's look at yet another core module, Math::BigInt, which can handle integers beyond Perl's native reach.[*]
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 As before, this module imports nothing. Its entire interface uses class methods, such as new, against the class name to create instances, and then calls instance methods, such as bpow and bstr, against those instances. |