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

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

by dsheroh (Parson)
on May 16, 2012 at 07:32 UTC ( #970764=note: print w/ replies, xml ) Need Help??


in reply to Re^2: PERL modules named differently than the package won't export
in thread PERL modules named differently than the package won't export

I see. I guess that makes (some) sense.

How about this approach, then:

As Eliya mentioned, use Utils1; is equivalent to

BEGIN { require Utils1; Utils1->import; }
You should, therefore, be able to make the import from the Utils package transparent by editing Utils1.pm to do something along the lines of
package Utils1; sub import { Utils->export_to_level(1, @_); } package Utils; ...
This will (assuming I remembered the incantation correctly) make Utils1->import equivalent to Utils->import.


Although, really, the better approach would likely be to put the two versions of Utils.pm into different library directories (e.g., /usr/local/devel/Utils.pm and /usr/local/stable/Utils.pm), then manipulating @INC (by setting PERL5LIB in the shell or with use lib in the code) so that each program will load the appropriate version.


Comment on Re^3: PERL modules named differently than the package won't export
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others contemplating the Monastery: (8)
As of 2014-09-22 18:19 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (198 votes), past polls