Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: require & import $module_name

by chromatic (Archbishop)
on Jul 19, 2012 at 19:41 UTC ( #982703=note: print w/ replies, xml ) Need Help??


in reply to require & import $module_name

What happens if you turn import into what's obviously a method call (if you already have an import symbol in your current package, you may have trouble) and use a named lexical?

use Symbol 'delete_package'; foreach my $module (@modules) { require "sub/$module.pm"; $module->import(qw(foo bar)); foo(); bar(); # cleanup delete_package($module); }

Improve your skills with Modern Perl: the free book.


Comment on Re: require & import $module_name
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others scrutinizing the Monastery: (10)
As of 2015-07-07 00:11 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (85 votes), past polls