Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re: better ways than eval to dynamic load a module

by etcshadow (Priest)
on Apr 17, 2005 at 21:02 UTC ( #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
Node Status?
node history
Node Type: note [id://448690]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (8)
As of 2019-05-21 11:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    Do you enjoy 3D movies?



    Results (132 votes). Check out past polls.

    Notices?
    • (Sep 10, 2018 at 22:53 UTC) Welcome new users!