Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re: Export not exporting from module

by chromatic (Archbishop)
on Feb 21, 2014 at 18:35 UTC ( [id://1075765]=note: print w/replies, xml ) Need Help??


in reply to Export not exporting from module

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.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1075765]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others learning in the Monastery: (6)
As of 2024-04-19 13:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found