Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re^4: eval "require $module" vs. Module::Load::load($module)

by djerius (Beadle)
on Aug 17, 2007 at 14:59 UTC ( [id://633321]=note: print w/replies, xml ) Need Help??


in reply to Re^3: eval "require $module" vs. Module::Load::load($module)
in thread eval "require $module" vs. Module::Load::load($module)

I'm aware of Perl exceptions and how to handle them. What I do with $@ is really not germane to the question, which is to determine if there is any functional difference between Module::Load and eval "require $module".

Your code uses the same general approach as Module::Load (albeit expressed more succinctly) namely to create a filename out of a module name and pass that to require.

So, other than style, is there any technical reason to choose this method over

eval "require $module"; die $@ if $@;

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (2)
As of 2024-04-20 03:30 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found