Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot
 
PerlMonks  

Re: better ways than eval to dynamic load a module

by etcshadow (Priest)
on Apr 17, 2005 at 21:02 UTC ( [id://448690]=note: print w/replies, xml ) Need Help??


in reply to better ways than eval to dynamic load a module

Well, you could always do something like this:
my $file = "$op.pm"; $file =~ s/::/\//g; # / on *nix, \ on windows, etc. the point is: you +r local path separator require $file;
Roughly the same, but no eval. However, if you actually use this regexp on the modulename: /^[\w:]+$/s, then I'm pretty certain that it's not possible to put in anything that could be bad.
------------ :Wq Not an editor command: Wq

Log In?
Username:
Password:

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

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

    No recent polls found