line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::JSON::Advance; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
# Pragmas. |
4
|
4
|
|
|
4
|
|
40029
|
use base qw(Exporter); |
|
4
|
|
|
|
|
9
|
|
|
4
|
|
|
|
|
656
|
|
5
|
4
|
|
|
4
|
|
22
|
use strict; |
|
4
|
|
|
|
|
5
|
|
|
4
|
|
|
|
|
134
|
|
6
|
4
|
|
|
4
|
|
15
|
use warnings; |
|
4
|
|
|
|
|
8
|
|
|
4
|
|
|
|
|
140
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
# Modules. |
9
|
4
|
|
|
4
|
|
3635
|
use Error::Pure::Output::JSON qw(err_json); |
|
4
|
|
|
|
|
170040
|
|
|
4
|
|
|
|
|
119
|
|
10
|
4
|
|
|
4
|
|
10234
|
use Error::Pure::Utils qw(err_helper); |
|
4
|
|
|
|
|
16552
|
|
|
4
|
|
|
|
|
119
|
|
11
|
4
|
|
|
4
|
|
7764
|
use List::MoreUtils qw(none); |
|
4
|
|
|
|
|
44016
|
|
|
4
|
|
|
|
|
40
|
|
12
|
4
|
|
|
4
|
|
2255
|
use Readonly; |
|
4
|
|
|
|
|
27
|
|
|
4
|
|
|
|
|
1538
|
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
# Constants. |
15
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
16
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Version. |
19
|
|
|
|
|
|
|
our $VERSION = 0.06; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Global variables. |
22
|
|
|
|
|
|
|
our %ERR_PARAMETERS; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Ignore die signal. |
25
|
|
|
|
|
|
|
$SIG{__DIE__} = 'IGNORE'; |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Process error. |
28
|
|
|
|
|
|
|
sub err { |
29
|
5
|
|
|
5
|
1
|
13019
|
my @msg = @_; |
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
# Get errors structure. |
32
|
5
|
|
|
|
|
51
|
my @errors = err_helper(@msg); |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
# Finalize in main on last err. |
35
|
5
|
|
|
|
|
3940
|
my $stack_ar = $errors[-1]->{'stack'}; |
36
|
5
|
50
|
33
|
|
|
77
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
37
|
10
|
100
|
|
10
|
|
74
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
38
|
10
|
|
|
|
|
68
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
5
|
|
|
|
|
18
|
|
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
0
|
my $err_hr = { |
41
|
|
|
|
|
|
|
'error-pure' => \@errors, |
42
|
|
|
|
|
|
|
}; |
43
|
0
|
|
|
|
|
0
|
foreach my $key (keys %ERR_PARAMETERS) { |
44
|
0
|
|
|
|
|
0
|
$err_hr->{$key} = $ERR_PARAMETERS{$key}; |
45
|
|
|
|
|
|
|
} |
46
|
0
|
|
|
|
|
0
|
die err_json($err_hr)."\n"; |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
# Die for eval. |
49
|
|
|
|
|
|
|
} else { |
50
|
5
|
|
|
|
|
224
|
die "$errors[-1]->{'msg'}->[0]\n"; |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
|
53
|
0
|
|
|
|
|
|
return; |
54
|
|
|
|
|
|
|
} |
55
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
1; |
57
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
__END__ |