line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::HTTP::ErrorList; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
61961
|
use base qw(Exporter); |
|
3
|
|
|
|
|
22
|
|
|
3
|
|
|
|
|
337
|
|
4
|
3
|
|
|
3
|
|
17
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
53
|
|
5
|
3
|
|
|
3
|
|
11
|
use warnings; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
83
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1172
|
use Error::Pure::Utils qw(err_helper); |
|
3
|
|
|
|
|
14031
|
|
|
3
|
|
|
|
|
51
|
|
8
|
3
|
|
|
3
|
|
1506
|
use Error::Pure::Output::Text qw(err_line_all); |
|
3
|
|
|
|
|
3624
|
|
|
3
|
|
|
|
|
51
|
|
9
|
3
|
|
|
3
|
|
1864
|
use List::MoreUtils qw(none); |
|
3
|
|
|
|
|
31215
|
|
|
3
|
|
|
|
|
15
|
|
10
|
3
|
|
|
3
|
|
2455
|
use Readonly; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
812
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Constants. |
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
# Version. |
17
|
|
|
|
|
|
|
our $VERSION = 0.15; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
# Ignore die signal. |
20
|
|
|
|
|
|
|
$SIG{__DIE__} = 'IGNORE'; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Process error. |
23
|
|
|
|
|
|
|
sub err { |
24
|
5
|
|
|
5
|
1
|
1641
|
my @msg = @_; |
25
|
|
|
|
|
|
|
|
26
|
|
|
|
|
|
|
# Get errors structure. |
27
|
5
|
|
|
|
|
15
|
my @errors = err_helper(@msg); |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
# Finalize in main on last err. |
30
|
5
|
|
|
|
|
812
|
my $stack_ar = $errors[-1]->{'stack'}; |
31
|
5
|
50
|
33
|
|
|
26
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
32
|
10
|
100
|
|
10
|
|
33
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
33
|
10
|
|
|
|
|
24
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
5
|
|
|
|
|
9
|
|
34
|
|
|
|
|
|
|
|
35
|
0
|
|
|
|
|
0
|
print "Content-type: text/plain\n\n"; |
36
|
0
|
|
|
|
|
0
|
print err_line_all(@errors); |
37
|
0
|
|
|
|
|
0
|
return; |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
# Die for eval. |
40
|
|
|
|
|
|
|
} else { |
41
|
5
|
|
|
|
|
10
|
my $e = $errors[-1]->{'msg'}->[0]; |
42
|
5
|
50
|
|
|
|
22
|
if (! defined $e) { |
43
|
0
|
|
|
|
|
0
|
$e = 'undef'; |
44
|
|
|
|
|
|
|
} else { |
45
|
5
|
|
|
|
|
8
|
chomp $e; |
46
|
|
|
|
|
|
|
} |
47
|
5
|
|
|
|
|
46
|
die "$e\n"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |