Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
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 imbibing at the Monastery: (5)
As of 2015-01-26 02:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My top resolution in 2015 is:

















    Results (186 votes), past polls