In data 09 agosto 2010 alle ore 17:27:52, David E. Wheeler
<da...@kineticode.com> ha scritto:
On Aug 9, 2010, at 8:21 AM, Cosimo Streppone wrote:
package Foo;
sub DESTROY { exit; }
my $foo = bless {}, 'Foo';
I couldn't try this yet, but, I don't think this
would segfault.
What I *guess* happens is that the 'exit' will cause
the script to immediately exit, skipping the nasty
part that would otherwise segfault.
Which nasty part?
Ehm... scrap that :)
Your patch with 'unless' reversed to 'if' works fine.
Just for clarity, here's the full DESTROY() of 16destroy.t:
sub DESTROY {
if ($expect_active < 0) { # inside child
my $self = shift;
exit ($self->FETCH('Active') || 0) unless $^O eq 'MSWin32';
# On Win32, the forked child is actually a thread. So don't
exit,
# and report failure directly.
fail 'Child should be inactive on DESTROY'
if $self->FETCH('Active');
} else {
return $expect_active
? ok( shift->FETCH('Active'), 'Should be active in
DESTROY')
: ok( !shift->FETCH('Active'), 'Should not be active in
DESTROY');
}
}
Will try and let you know.
Thanks!
Done. Passes all tests. This is perl 5.10.0
on MSWin32 + MSVC9 (cc='cl' and ccversion '15.00.21022.08')
--
Cosimo