Beefy Boxes and Bandwidth Generously Provided by pair Networks
We don't bite newbies here... much
 
PerlMonks  

Re^4: Help Changing use into require/import

by Discipulus (Canon)
on Mar 07, 2018 at 22:03 UTC ( [id://1210485]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Help Changing use into require/import
in thread Help Changing use into require/import

> I wonder if "undef $@" before the eval would help ensure any error ending up in $@ is coming from the eval?

Better using local in such case (I think..)

{ local $@; eval "use Capture::Tiny qw(capture)"; if ( !$@ ) { $HAVE_Capture_Tiny = 1; } }

See also eval, DESTROY, die and $@ - educational couple of hours

L*

There are no rules, there are no thumbs..
Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.

Replies are listed 'Best First'.
Re^5: Help Changing use into require/import
by stevieb (Canon) on Mar 07, 2018 at 22:08 UTC

    Yes, localizing $@ will get rid of at least one problem for certain, where $@ is quashed if it already has something from a previous eval.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others about the Monastery: (6)
As of 2024-04-19 06:15 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found