> I think the DESTROY method is responsible for preserving the value of
> $@ --- either by appending the new $@ value to the old one or by
> localizing [EMAIL PROTECTED]

There's another problem with this work-around -- it breaks in the other
direction!

tin-foil:/tmp glasser$ cat /tmp/localdie
sub i_die {
    die "this is why I died";
}

sub i_localize_dollar_at { # This could certainly be DESTROY
    local $@;
    i_die();
}

eval { i_localize_dollar_at() };

my $error = $@;

if ($error) {
    print "The error was: $error\n";
} else {
    print "There was no error.  (Or was there?)\n";
}
tin-foil:/tmp glasser$ perl localdie
There was no error.  (Or was there?)




That is, localizing $@ in DESTROY solves the problem of "an eval inside
the DESTROY hides an error that happened before the DESTROY", but it
causes the problem that it hides an error that happens *in* the DESTROY!

I'm not sure if Alex's patch has this issue too.

--dave

Reply via email to