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