Skip Menu |

This queue is for tickets about the Moose CPAN distribution.

Report information
The Basics
Id: 48271
Status: resolved
Priority: 0/
Queue: Moose

People
Owner: Nobody in particular
Requestors: zefram [...] fysh.org
Cc:
AdminCc:

Bug Information
Severity: (no value)
Broken in: (no value)
Fixed in: 0.90



Subject: Moose::Object DESTROY should localise more
Date: Tue, 28 Jul 2009 15:19:53 +0100
To: bug-Moose [...] rt.cpan.org
From: Zefram <zefram [...] fysh.org>
The DESTROY method in Moose::Object attempts to avoid the problem of clobbering $@, by localising it. However, there are two problems with the way it does this. Firstly, it only localises $@ if $@ had a true value to start with. Clobbering a false $@ is just as much a problem, so the localisation should be unconditional. Secondly, there are four other status variables suffering the same problem as $@, which should therefore also be localised. The resulting DESTROY method would be: sub DESTROY { local($., $@, $!, $^E, $?); $_[0]->DEMOLISHALL(in_global_destruction); } -zefram
On Tue Jul 28 10:20:22 2009, zefram@fysh.org wrote: Show quoted text
> The DESTROY method in Moose::Object attempts to avoid the problem of > clobbering $@, by localising it. However, there are two problems with > the way it does this. Firstly, it only localises $@ if $@ had a true > value to start with. Clobbering a false $@ is just as much a problem, > so the localisation should be unconditional. Secondly, there are four > other status variables suffering the same problem as $@, which should > therefore also be localised. The resulting DESTROY method would be: > > sub DESTROY { > local($., $@, $!, $^E, $?); > $_[0]->DEMOLISHALL(in_global_destruction); > } > > -zefram
I am stumped trying to make a test for this. I think the code above is right, but it'd be nic to actually test it somehow.
On Fri Sep 11 12:17:11 2009, DROLSKY wrote: Show quoted text
> On Tue Jul 28 10:20:22 2009, zefram@fysh.org wrote:
> > The DESTROY method in Moose::Object attempts to avoid the problem of > > clobbering $@, by localising it. However, there are two problems with > > the way it does this. Firstly, it only localises $@ if $@ had a true > > value to start with. Clobbering a false $@ is just as much a problem, > > so the localisation should be unconditional. Secondly, there are four > > other status variables suffering the same problem as $@, which should > > therefore also be localised. The resulting DESTROY method would be: > > > > sub DESTROY { > > local($., $@, $!, $^E, $?); > > $_[0]->DEMOLISHALL(in_global_destruction); > > } > > > > -zefram
> > I am stumped trying to make a test for this. I think the code above is > right, but it'd be nic to actually test it somehow.
Ignore this. Someone else came up with a test.
We didn't do exactly what you asked, but we did do something. If you have an argument that the current behavior is incorrect (as of 0.90), please email the moose list or join us on IRC to discuss.