use Data::Dumper qw(Dumper);
$SIG{__WARN__} = sub { &handle_it(@_); warn @_ };
$SIG{__DIE__} = sub { &handle_it(@_); die @_ };
sub handle_it {
print Dumper \@_;
}
####
die "foo"; # prints as "foo at script line whatever\n" - stringified
#die "foo", "foo"; # stringified - same as above but with "foofoo"
#die {hi => 'there'}; # not stringified - shows correctly as a hashref
#die 'foo',{hi => 'there'}; # stringified "fooHASH{whatever}"
#warn {hi => 'there'}; # always stringified
####
die "Something happend", {extra_argument_to_show_pretty_error => 1};