Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
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'

Replies are listed 'Best First'.
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
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..

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (6)
As of 2018-01-16 22:05 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    How did you see in the new year?










    Results (192 votes). Check out past polls.

    Notices?