Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical

Re^3: $@ alternative

by sgt (Deacon)
on Sep 10, 2007 at 08:30 UTC ( #638013=note: print w/replies, xml ) Need Help??

in reply to Re^2: $@ alternative
in thread $@ alternative

$@ is global, so yes you can localize it, (and in general you should make a local copy if you want to preserve a previous exception).

$@ being global, at the first exception triggered the previous contents of $@ will be destoyed, so that means probably your customer never used exception-eval blocks, or was just lucky, as the following code demonstrates.

% steph@ape (/home/stephan/r) % % perl -we '$@ = "customer stuff..."; eval { die "dont muck with $@!" +}; print $@' dont muck with ! at -e line 1. % steph@ape (/home/stephan/r) % % perl -we '$@ = "customer stuff..."; { local $@; eval { die "dont muc +k with $@!" }; } print $@' customer stuff...
cheers --stephan

Log In?

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

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (3)
As of 2023-03-27 04:25 GMT
Find Nodes?
    Voting Booth?
    Which type of climate do you prefer to live in?

    Results (63 votes). Check out past polls.