On Wed, 14 Aug 2002 07:47:31 -0700, Piers Cawley wrote:

> Further to this, here's a failing test script:
> 
> use Test::More tests => 2
> 
> sub Bar::DESTROY { eval { 1 } }
> 
> eval { my $obj = bless {}, 'Foo';
>        die "Deliberately" };
> like $@, qr/Deliberately/, "This passes";
> 
> eval { my $obj = bless {}, 'Bar';
>        die "Deliberately" };
> like $@, qr/Deliberately/, "This fails";
> 
> However, that still fails without the tests. However, the (complicated) code
> I've got that highlighted the problem works when there's no $SIG{__DIE__} in
> place. Back to the drawing board.

This looks like a standard end-of-scope action to me.  If you do this:

        sub Bar::DESTROY { local $@; eval { 1 } }

or this:

        my $obj;
        eval {
                $obj = bless {}, 'Bar';
                die "Delibarately";
        };

it works as I would expect.

What do you expect to see in $@ when an eval BLOCK fires successfully?

-- c

Reply via email to