Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
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; }

Replies are listed 'Best First'.
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?
[marinersk]: Poking around I find references to the XP Nodelet but something's not clicking. It shows up when I have votes; it shows up when my XP changes; but I can't see how to make it show up all the time. Am I missing something obvious here?

How do I use this? | Other CB clients
Other Users?
Others chilling in the Monastery: (7)
As of 2017-05-29 13:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?