in reply to Re: why did i die?
in thread why did i die?

Tested:

perl -we 'my $x = 0;eval "local \$SIG{__DIE__} = sub {\$x = 123};4/0"; + print "$x: $@"' 123: Illegal division by zero at (eval 1) line 1.

The run-time internal error also calls __DIE__.

Nastier: I do not know what code is ran inside the eval. It may (probably will) install its own __DIE__ handler.

Replies are listed 'Best First'.
Re^3: why did i die?
by LanX (Saint) on Apr 02, 2014 at 09:27 UTC
    you could check something like the errno in '$!' to distinguish.

    > I do not know what code is ran inside the eval.

    well then you'll probably also need a block-eval around the string eval.

    Cheers Rolf

    ( addicted to the Perl Programming Language)

      The $! will only be set when the die() is related to a failing operating system call (for instance open()). That does not work in cases like:

      defined $filename or die "no filename given";