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