Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
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 having an uproarious good time at the Monastery: (4)
As of 2015-07-30 04:26 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (269 votes), past polls