line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::Die; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
79388
|
use base qw(Exporter); |
|
5
|
|
|
|
|
38
|
|
|
5
|
|
|
|
|
731
|
|
4
|
5
|
|
|
5
|
|
34
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
108
|
|
5
|
5
|
|
|
5
|
|
21
|
use warnings; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
173
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
1733
|
use Error::Pure::Utils qw(err_helper); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
118
|
|
8
|
5
|
|
|
5
|
|
477
|
use List::Util qw(none); |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
645
|
|
9
|
5
|
|
|
5
|
|
34
|
use Readonly; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
3436
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.29; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
15
|
|
|
|
|
|
|
Readonly::Scalar my $EMPTY_STR => q{}; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Process error. |
18
|
|
|
|
|
|
|
sub err { |
19
|
14
|
|
|
14
|
1
|
2744
|
my @msg = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Get errors structure. |
22
|
14
|
|
|
|
|
49
|
my @errors = err_helper(@msg); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Finalize in main on last err. |
25
|
14
|
|
|
|
|
36
|
my $stack_ar = $errors[-1]->{'stack'}; |
26
|
14
|
50
|
33
|
|
|
73
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
27
|
28
|
100
|
|
28
|
|
125
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
28
|
28
|
|
|
|
|
95
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
14
|
|
|
|
|
42
|
|
29
|
|
|
|
|
|
|
|
30
|
0
|
|
|
|
|
0
|
my $die = (join $EMPTY_STR, @{$errors[-1]->{'msg'}}). |
|
0
|
|
|
|
|
0
|
|
31
|
|
|
|
|
|
|
" at $stack_ar->[0]->{'prog'} line ". |
32
|
|
|
|
|
|
|
"$stack_ar->[0]->{'line'}."; |
33
|
0
|
|
|
|
|
0
|
die "$die\n"; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
# Die for eval. |
36
|
|
|
|
|
|
|
} else { |
37
|
14
|
|
|
|
|
143
|
die "$errors[-1]->{'msg'}->[0]\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |