Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

Re: capture errors from eval

by tobyink (Abbot)
on Sep 23, 2012 at 21:05 UTC ( #995252=note: print w/ replies, xml ) Need Help??


in reply to capture errors from eval

Maybe...?

eval { eval $w }
perl -E'sub Monkey::do{say$_,for@_,do{($monkey=[caller(0)]->[3])=~s{::}{ }and$monkey}}"Monkey say"->Monkey::do'


Comment on Re: capture errors from eval
Download Code
Re^2: capture errors from eval
by sdetweil (Sexton) on Sep 23, 2012 at 21:19 UTC
    sorry, dumb answer.. only tested in one of two places.. this works great and $@ contains the error text..
Re^2: capture errors from eval
by sdetweil (Sexton) on Sep 23, 2012 at 21:30 UTC
    sorry, actually this does work!.. had two places and only tested on one (the wrong one obviously!).. thank you

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://995252]
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: (5)
As of 2014-09-18 03:45 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    How do you remember the number of days in each month?











    Results (105 votes), past polls