Think about Loose Coupling | |
PerlMonks |
Re: Export not exporting from moduleby chromatic (Archbishop) |
on Feb 21, 2014 at 18:35 UTC ( [id://1075765]=note: print w/replies, xml ) | Need Help?? |
You refer to the module with three different names, Logger, Logg, and MyLib::Logger. If you're not getting an error about a failed use of Logger, then Perl's loading it from a file named MyLib/Logger.pm, but MyLib/ is in @INC. Because that's how use loads it, Perl will try to call Logger->import( 'data_log' );. There's no failure if this import fails to exist in the package. Your package is MyLib::Logger, which does have an import but which doesn't get called, because its name doesn't match the name by which Perl loaded the file. Short answer: change package MyLib::Logger; to package Logger;. (Also change the comments for the sake of other people reading the code.) Improve your skills with Modern Perl: the free book.
In Section
Seekers of Perl Wisdom
|
|