Sunday, 17 May 2009

Beginning with module (cont.)

use Some::Package

will tell Perl to search for module Package in Some/Package.pm

but

@ISA = ("Some::Package")

will not direct Perl correctly to the tree Some/Package.pm

why???? and how to tell Perl that we WANT Some/Package.pm, not Some::Package ???

Beginning with module



All the books and forum about Perl Modules converge in saying this:

when you

use Some::Package;

Perl will look for Package.pm in directory tree ./Some/Package.pm

Sure, but...

The important thing that almost nobody has remembered to refer that, in the Package.pm, the first line must be

package Some::Package;

not

package Package;

if the package is not specified like that, you will undoubtedly receive error message saying that

"can't locate object method via package Some::Package ... perhaps you forgot to load Some::Package at use_some_package.pl line xx"

And here's the example