line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::ANSIColor::PrintVar; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
73194
|
use base qw(Exporter); |
|
2
|
|
|
|
|
24
|
|
|
2
|
|
|
|
|
285
|
|
4
|
2
|
|
|
2
|
|
23
|
use strict; |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
69
|
|
5
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
76
|
|
6
|
|
|
|
|
|
|
|
7
|
2
|
|
|
2
|
|
1041
|
use Error::Pure::Output::ANSIColor qw(err_print_var); |
|
2
|
|
|
|
|
33054
|
|
|
2
|
|
|
|
|
49
|
|
8
|
2
|
|
|
2
|
|
1181
|
use Error::Pure::Utils qw(err_helper); |
|
2
|
|
|
|
|
3033
|
|
|
2
|
|
|
|
|
35
|
|
9
|
2
|
|
|
2
|
|
157
|
use List::Util qw(none); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
210
|
|
10
|
2
|
|
|
2
|
|
16
|
use Readonly; |
|
2
|
|
|
|
|
13
|
|
|
2
|
|
|
|
|
550
|
|
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.28; |
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 scalar err_print_var(@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__ |