Beefy Boxes and Bandwidth Generously Provided by pair Networks
more useful options
 
PerlMonks  

Re: Re: Devious destructor

by Juerd (Abbot)
on Mar 13, 2002 at 15:29 UTC ( [id://151400]=note: print w/replies, xml ) Need Help??


in reply to Re: Devious destructor
in thread Devious destructor

That's good defensive programming

It sure is!
Defensive programming can bite you, though. Kane, one of the Rotterdam Perl Mongers once told the story about what happens if you localize $@ in a BEGIN block. By programming defensively, he ran into a bug in perl :)

perl -e'BEGIN { local $@; print "a"; die "b"; print "c"; } print "d";'
It turns out that the program doesn't die, and it doesn't display "b" (and not "at -e line 1"). The snippet above prints "ad". If it didn't localize $@, it would print:
b at -e line 1. BEGIN failed--compilation aborted at -e line 1.
Scary, huh?

If you localize special variables, look out for bugs, and if you find any, report them!

U28geW91IGNhbiBhbGwgcm90MTMgY
W5kIHBhY2soKS4gQnV0IGRvIHlvdS
ByZWNvZ25pc2UgQmFzZTY0IHdoZW4
geW91IHNlZSBpdD8gIC0tIEp1ZXJk

Log In?
Username:
Password:

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

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

    No recent polls found