/usr/share/perl5/Log/Report/Die.pm is in liblog-report-perl 1.18-1.
This file is owned by root:root, with mode 0o644.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 | # Copyrights 2007-2016 by [Mark Overmeer].
# For other contributors see ChangeLog.
# See the manual pages for details on the licensing terms.
# Pod stripped from pm file by OODoc 2.02.
use warnings;
use strict;
package Log::Report::Die;
use vars '$VERSION';
$VERSION = '1.18';
use base 'Exporter';
our @EXPORT = qw/die_decode/;
use POSIX qw/locale_h/;
sub die_decode($%)
{ my ($text, %args) = @_;
my @text = split /\n/, $text;
@text or return ();
chomp $text[-1];
# Try to catch the error directly, to remove it from the error text
my %opt = (errno => $! + 0);
my $err = "$!";
my $dietxt = $text[0];
if($text[0] =~ s/ at (.+) line (\d+)\.?$// )
{ $opt{location} = [undef, $1, $2, undef];
}
elsif(@text > 1 && $text[1] =~ m/^\s*at (.+) line (\d+)\.?$/ )
{ # sometimes people carp/confess with \n, folding the line
$opt{location} = [undef, $1, $2, undef];
splice @text, 1, 1;
}
$text[0] =~ s/\s*[.:;]?\s*$err\s*$// # the $err is translation sensitive
or delete $opt{errno};
my @msg = shift @text;
length $msg[0] or $msg[0] = 'stopped';
my @stack;
foreach (@text)
{ if(m/^\s*(.*?)\s+called at (.*?) line (\d+)\s*$/)
{ push @stack, [ $1, $2, $3 ] }
else { push @msg, $_ }
}
$opt{stack} = \@stack;
$opt{classes} = [ 'perl', (@stack ? 'confess' : 'die') ];
my $reason
= $opt{errno} ? 'FAULT'
: @stack ? 'PANIC'
: $args{on_die} || 'ERROR';
($dietxt, \%opt, $reason, join("\n", @msg));
}
"to die or not to die, that's the question";
|