Is there a way to stop a die(); statement?
So far I've found: $SIG{__DIE__} = sub { };
However, that I can't figure out anything to stop a die();
You have already been given a good answer. But, I beg your pardon, to
me the expression "to stop a die()" is ambiguous. You can "stop" a die
by exiting the call before it is completed:
#!/usr/bin/perl -l
use strict;
use warnings;
no warnings 'uninitialized';
open my $fh, "<\000" or die $ARGV[0] && goto HEHE;
HEHE: print 'done!'
__END__
# ./die.pl
Died at ./die.pl line 7.
# ./die.pl 0
0 at ./die.pl line 7.
# ./die.pl 1
done!
Please note that I'm by no means a goto() fanatic, I'd say quite the
contrary indeed, and I do not want to encourage its use! That may well
have been a return() in a sub or a next or last in a cycle, the key
point being that, to me, "to stop" is related to something that has
already started and can well be stopped, as the example shows...
HTH,
Michele