line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::Error; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
77264
|
use base qw(Exporter); |
|
3
|
|
|
|
|
28
|
|
|
3
|
|
|
|
|
394
|
|
4
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
57
|
|
5
|
3
|
|
|
3
|
|
27
|
use warnings; |
|
3
|
|
|
|
|
15
|
|
|
3
|
|
|
|
|
100
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
1311
|
use Error::Pure::Utils qw(err_helper); |
|
3
|
|
|
|
|
8
|
|
|
3
|
|
|
|
|
61
|
|
8
|
3
|
|
|
3
|
|
3507
|
use Error::Pure::Output::Text qw(err_line); |
|
3
|
|
|
|
|
4620
|
|
|
3
|
|
|
|
|
61
|
|
9
|
3
|
|
|
3
|
|
266
|
use List::Util qw(none); |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
341
|
|
10
|
3
|
|
|
3
|
|
22
|
use Readonly; |
|
3
|
|
|
|
|
5
|
|
|
3
|
|
|
|
|
757
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Constants. |
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
our $VERSION = 0.29; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
# Process error. |
19
|
|
|
|
|
|
|
sub err { |
20
|
5
|
|
|
5
|
1
|
2667
|
my @msg = @_; |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
# Get errors structure. |
23
|
5
|
|
|
|
|
18
|
my @errors = err_helper(@msg); |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
# Finalize in main on last err. |
26
|
5
|
|
|
|
|
12
|
my $stack_ar = $errors[-1]->{'stack'}; |
27
|
5
|
50
|
33
|
|
|
27
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
28
|
10
|
100
|
|
10
|
|
40
|
&& none { $_ eq $EVAL || $_ =~ m/^eval '/ms } |
29
|
10
|
|
|
|
|
28
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
5
|
|
|
|
|
12
|
|
30
|
|
|
|
|
|
|
|
31
|
0
|
|
|
|
|
0
|
die err_line(@errors); |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
# Die for eval. |
34
|
|
|
|
|
|
|
} else { |
35
|
5
|
|
|
|
|
29
|
die "$errors[-1]->{'msg'}->[0]\n"; |
36
|
|
|
|
|
|
|
} |
37
|
|
|
|
|
|
|
|
38
|
0
|
|
|
|
|
|
return; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
__END__ |