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

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

Thread Previous | Thread Next
June 24, 2008 14:09
Re: Why $@ makes me cry (was Re: Generic system() replacements)
Message ID:
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.


Thread Previous | Thread Next Perl Programming lists via nntp and http.
Comments to Ask Bjørn Hansen at | Group listing | About