Beefy Boxes and Bandwidth Generously Provided by pair Networks
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Re: PERL modules named differently than the package won't export

by Eliya (Vicar)
on May 14, 2012 at 16:48 UTC ( #970464=note: print w/ replies, xml ) Need Help??


in reply to PERL modules named differently than the package won't export

The problem is that if you use a different name in the use statement than what you have named the package, Perl will try to call the import method on the wrong package.  In your case, it tries to call Utils1->import, and, as there is no such package/method, nothing is being called and consequently nothing imported.

So don't do this.  Or if you really want to, make the appropriate import call yourself. I.e. instead of use Utils1, write:

BEGIN { require Utils1; Utils->import; }


Comment on Re: PERL modules named differently than the package won't export
Select or Download Code
Re^2: PERL modules named differently than the package won't export
by kovacsbv (Novice) on May 15, 2012 at 16:44 UTC

    Thanks, Eliya.

    That solved the problem. Now I can modify the .pm and use it in a more risk-tolerant .pl and when we're all comfortable that it won't blow up, we can start moving it into other .pl files that are risk-averse.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others wandering the Monastery: (12)
As of 2014-11-26 19:13 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My preferred Perl binaries come from:














    Results (172 votes), past polls