BEGIN { $SIG{__DIE__} = sub { my $string = shift; chomp($string); my ($package, $file, $line) = caller; die "$string [at $file, line $line]\n" unless ($package eq 'Carp'); } } #### BEGIN { $SIG{__DIE__} = sub { my $string = shift; chomp($string); my ($package, $file, $line) = caller; confess "$string\n" if ((defined ($^S)) and not $^S); } }