in reply to why did i die?
I do have a partial solution. When my own __DIE__ handler is being called (but I think I cannot guarantee that), then the runtime error will have no caller() info.
So, when the eval'ed code does not mess with the __DIE__ handler, I can differentiate the three:
my $cause = 'PARSER'; eval { local $SIG{__DIE__} = sub { $cause = caller ? 'EXPLICIT' : 'INTERNAL'}; $do_something(); }; print $cause if $@;
Now a solution without the volatile __DIE__
|
|---|