Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Re: require & import $module_name

by tobyink (Canon)
on Jul 19, 2012 at 19:45 UTC ( [id://982705]=note: print w/replies, xml ) Need Help??


in reply to require & import $module_name

eval "use $module" is pretty simple if you're 100% confident that the $module variable contains a safe package name. (You want to be sure that it doesn't contain something like "strict; system('rm -fr /home')"!)

Module::Runtime and Class::Load provide somewhat safer techniques if you're less sure about the contents of the variable (e.g. the variable came from the outside world).

perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-24 18:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found