line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::ANSIColor::Print; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
72098
|
use base qw(Exporter); |
|
2
|
|
|
|
|
21
|
|
|
2
|
|
|
|
|
288
|
|
4
|
2
|
|
|
2
|
|
16
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
50
|
|
5
|
2
|
|
|
2
|
|
27
|
use warnings; |
|
2
|
|
|
|
|
10
|
|
|
2
|
|
|
|
|
61
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1028
|
use Error::Pure::Output::ANSIColor qw(err_print); |
|
2
|
|
|
|
|
32769
|
|
|
2
|
|
|
|
|
83
|
|
8
|
2
|
|
|
2
|
|
1157
|
use Error::Pure::Utils qw(err_helper); |
|
2
|
|
|
|
|
3281
|
|
|
2
|
|
|
|
|
34
|
|
9
|
2
|
|
|
2
|
|
1270
|
use List::MoreUtils qw(none); |
|
2
|
|
|
|
|
27807
|
|
|
2
|
|
|
|
|
13
|
|
10
|
2
|
|
|
2
|
|
2119
|
use Readonly; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
597
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
# Constants. |
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EMPTY_STR => q{}; |
15
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $VERSION = 0.27; |
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 || $_ =~ /^eval '/ms } |
30
|
0
|
|
|
|
|
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
0
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
32
|
0
|
|
|
|
|
|
die err_print(@errors)."\n"; |
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__ |