line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::Die; |
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
76009
|
use base qw(Exporter); |
|
5
|
|
|
|
|
34
|
|
|
5
|
|
|
|
|
648
|
|
4
|
5
|
|
|
5
|
|
33
|
use strict; |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
103
|
|
5
|
5
|
|
|
5
|
|
25
|
use warnings; |
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
166
|
|
6
|
|
|
|
|
|
|
|
7
|
5
|
|
|
5
|
|
1751
|
use Error::Pure::Utils qw(err_helper); |
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
109
|
|
8
|
5
|
|
|
5
|
|
446
|
use List::Util qw(none); |
|
5
|
|
|
|
|
9
|
|
|
5
|
|
|
|
|
581
|
|
9
|
5
|
|
|
5
|
|
34
|
use Readonly; |
|
5
|
|
|
|
|
8
|
|
|
5
|
|
|
|
|
3306
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.31; |
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
|
2675
|
my @msg = @_; |
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
# Get errors structure. |
22
|
14
|
|
|
|
|
45
|
my @errors = err_helper(@msg); |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Finalize in main on last err. |
25
|
14
|
|
|
|
|
32
|
my $stack_ar = $errors[-1]->{'stack'}; |
26
|
14
|
50
|
33
|
|
|
81
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
27
|
28
|
100
|
|
28
|
|
123
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
28
|
28
|
|
|
|
|
89
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
14
|
|
|
|
|
34
|
|
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
|
|
|
|
|
129
|
die "$errors[-1]->{'msg'}->[0]\n"; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
1; |
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
__END__ |