line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::JSON::Advance; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
109739
|
use base qw(Exporter); |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
433
|
|
4
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
18
|
|
|
3
|
|
|
|
|
69
|
|
5
|
3
|
|
|
3
|
|
22
|
use warnings; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
117
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1471
|
use Error::Pure::Output::JSON qw(err_json); |
|
3
|
|
|
|
|
53093
|
|
|
3
|
|
|
|
|
78
|
|
8
|
3
|
|
|
3
|
|
1645
|
use Error::Pure::Utils qw(err_helper); |
|
3
|
|
|
|
|
4599
|
|
|
3
|
|
|
|
|
55
|
|
9
|
3
|
|
|
3
|
|
3529
|
use List::MoreUtils qw(none); |
|
3
|
|
|
|
|
40747
|
|
|
3
|
|
|
|
|
21
|
|
10
|
3
|
|
|
3
|
|
3253
|
use Readonly; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
1141
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Constants. |
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = 0.08; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Global variables. |
19
|
|
|
|
|
|
|
our %ERR_PARAMETERS; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Ignore die signal. |
22
|
|
|
|
|
|
|
$SIG{__DIE__} = 'IGNORE'; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Process error. |
25
|
|
|
|
|
|
|
sub err { |
26
|
5
|
|
|
5
|
1
|
2033
|
my @msg = @_; |
27
|
|
|
|
|
|
|
|
28
|
|
|
|
|
|
|
# Get errors structure. |
29
|
5
|
|
|
|
|
18
|
my @errors = err_helper(@msg); |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Finalize in main on last err. |
32
|
5
|
|
|
|
|
987
|
my $stack_ar = $errors[-1]->{'stack'}; |
33
|
5
|
50
|
33
|
|
|
32
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
34
|
10
|
100
|
|
10
|
|
46
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
35
|
10
|
|
|
|
|
63
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
5
|
|
|
|
|
12
|
|
36
|
|
|
|
|
|
|
|
37
|
0
|
|
|
|
|
0
|
my $err_hr = { |
38
|
|
|
|
|
|
|
'error-pure' => \@errors, |
39
|
|
|
|
|
|
|
}; |
40
|
0
|
|
|
|
|
0
|
foreach my $key (keys %ERR_PARAMETERS) { |
41
|
0
|
|
|
|
|
0
|
$err_hr->{$key} = $ERR_PARAMETERS{$key}; |
42
|
|
|
|
|
|
|
} |
43
|
0
|
|
|
|
|
0
|
die err_json($err_hr)."\n"; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
# Die for eval. |
46
|
|
|
|
|
|
|
} else { |
47
|
5
|
|
|
|
|
33
|
die "$errors[-1]->{'msg'}->[0]\n"; |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
|
50
|
0
|
|
|
|
|
|
return; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
|
|
|
|
|
|
1; |
54
|
|
|
|
|
|
|
|
55
|
|
|
|
|
|
|
__END__ |