- or download this
$SIG{__WARN__} = sub
{
...
print STDOUT "Warning generated at line $loc[2] in $loc[1]:\n", @_
+, "\n";
return 1;
};
- or download this
use warnings FATAL => qw( all );
- or download this
$SIG{__WARN__} = sub { CORE::die "Warning:\n", @_, "\n" };
- or download this
use Carp;
sub CallStack
...
shift @stack for 1..3; # Cover our tracks.
return wantarray ? @stack : join "\n", @stack;
}
- or download this
sub Something
{
...
# catch
HandleEvalError( $@ ) if $@;
}
- or download this
BEGIN{ $SIG{__DIE__} = \&FatalErr }
# Real problem if compile fails before getting here.
sub FatalErr { # do stuff, maybe print @_ or something.
}