laziness, impatience, and hubris | |
PerlMonks |
Re: Exporter/@ISA confusionby vinoth.ree (Monsignor) |
on Jun 09, 2014 at 09:56 UTC ( [id://1089246]=note: print w/replies, xml ) | Need Help?? |
@ISA:
Each package contains a special array called @ISA. The @ISA array contains a list of that class's parent classes, if any. Exporter:You need to use use Exporter; in your module to get the @EXPORT array into the calling script/module, when anyone invokes a use declaration to load your module, it calls the import method from your module to fetch any symbols it needs into the package of the invoker. Your module (the one doing the exporting) can define the import method any way it pleases, but the standard way is to inherit the method from the Exporter class module. The Exporter module serves as a base class for modules that wish to establish their own exports. Oddly, object-oriented modules typically don't use Exporter, since they don't normally export anything. The import() method is invoked as a class method in your module: MyModule->import(LIST). However, since you didn't define an import method in your module, you'll automatically make use of the Exporter::import method through inheritance. All is well
In Section
Seekers of Perl Wisdom
|
|