develooper Front page | perl.perl5.porters | Postings from June 2008

Re: Why $@ makes me cry (was Re: Generic system() replacements)

Thread Previous | Thread Next
From:
Abigail
Date:
June 24, 2008 14:09
Subject:
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
20080624153933.GD6072@almanda
On Sat, Jun 21, 2008 at 12:25:53PM +1000, Paul Fenwick wrote:
>
> However I believe there may be some merit in saving $@ before a DESTROY 
> is called, and restoring it afterwards.  That allows destruction to occur 
> as it always has, but prevents said destruction from clobbering $@.  I 
> imagine trying to capture a $@ from object destruction that's essentially 
> happening "between the lines" is going to be a rather rare occurrence 
> indeed.


Eh, I know I shouldn't have done this, but I have written code that could
die inside a DESTROY, with an eval to capture this exception. That code
would fail if $@ is saved before a DESTROY and then restored.

Now, I don't really care about this specific piece of code (I doubt it's
still running), but there might be some other code out there that relies
on this. That's not to say I would oppose such a change, IMO, the benefits
outweight the breakage of code written by a handful of freaks, but in general
we do care about backwards compat issues.



Abigail

Thread Previous | Thread Next


nntp.perl.org: Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at ask@perl.org | Group listing | About