Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation
 
PerlMonks  

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

by djerius (Beadle)
on Aug 17, 2007 at 14:59 UTC ( #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 $@;


Comment on Re^4: eval "require $module" vs. Module::Load::load($module)
Select or Download Code

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (10)
As of 2014-10-22 15:59 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (119 votes), past polls