Beefy Boxes and Bandwidth Generously Provided by pair Networks
"be consistent"
 
PerlMonks  

Re^2: loading modules at runtime

by blazar (Canon)
on Oct 14, 2006 at 21:52 UTC ( [id://578325]=note: print w/replies, xml ) Need Help??


in reply to Re: loading modules at runtime
in thread loading modules at runtime

$pm =~ s{::}{/}g; $pm .= '.pm'; eval { require $pm } or die("Unable to load plugin $plugin: $@\n");

Just one question, I'm all against string eval most of the time, but in this case would it be much different to avoid the self-made $plugin "conversion" and do

eval qq{ require $plugin } or die("Unable to load plugin $plugin: $@\n");

instead?

Replies are listed 'Best First'.
Re^3: loading modules at runtime
by ikegami (Patriarch) on Oct 15, 2006 at 01:23 UTC

    Your call. My method is documented in require (see below) and used by core module if.

    If EXPR is a bareword, the require assumes a ".pm" extension and replaces "::" with "/" in the filename for you, to make it easy to load standard modules

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (3)
As of 2024-03-19 11:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found