Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number

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 $@;

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://633321]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others rifling through the Monastery: (6)
As of 2018-03-18 22:27 GMT
Find Nodes?
    Voting Booth?
    When I think of a mole I think of:

    Results (231 votes). Check out past polls.