line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Error::Pure::NoDie; |
2
|
|
|
|
|
|
|
|
3
|
3
|
|
|
3
|
|
108714
|
use base qw(Exporter); |
|
3
|
|
|
|
|
20
|
|
|
3
|
|
|
|
|
376
|
|
4
|
3
|
|
|
3
|
|
21
|
use strict; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
57
|
|
5
|
3
|
|
|
3
|
|
23
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
107
|
|
6
|
|
|
|
|
|
|
|
7
|
3
|
|
|
3
|
|
984
|
use Error::Pure::Utils qw(err_helper); |
|
3
|
|
|
|
|
12096
|
|
|
3
|
|
|
|
|
66
|
|
8
|
3
|
|
|
3
|
|
1448
|
use List::MoreUtils qw(none); |
|
3
|
|
|
|
|
25482
|
|
|
3
|
|
|
|
|
17
|
|
9
|
3
|
|
|
3
|
|
2821
|
use Readonly; |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
1134
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
our $VERSION = 0.05; |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
Readonly::Array our @EXPORT_OK => qw(err); |
14
|
|
|
|
|
|
|
Readonly::Scalar my $EMPTY_STR => q{}; |
15
|
|
|
|
|
|
|
Readonly::Scalar my $EVAL => 'eval {...}'; |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# Ignore die signal. |
18
|
|
|
|
|
|
|
$SIG{__DIE__} = 'IGNORE'; |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
# Process error. |
21
|
|
|
|
|
|
|
sub err { |
22
|
7
|
|
|
7
|
1
|
3359
|
my @msg = @_; |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
# Get errors structure. |
25
|
7
|
|
|
|
|
24
|
my @errors = err_helper(@msg); |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
# Error messages. |
28
|
7
|
|
|
|
|
1551
|
chomp $errors[-1]->{'msg'}->[0]; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# Finalize in main on last err. |
31
|
7
|
|
|
|
|
14
|
my $stack_ar = $errors[-1]->{'stack'}; |
32
|
7
|
100
|
66
|
|
|
40
|
if ($stack_ar->[-1]->{'class'} eq 'main' |
33
|
13
|
100
|
|
13
|
|
58
|
&& none { $_ eq $EVAL || $_ =~ /^eval '/ms } |
34
|
13
|
|
|
|
|
39
|
map { $_->{'sub'} } @{$stack_ar}) { |
|
7
|
|
|
|
|
16
|
|
35
|
|
|
|
|
|
|
|
36
|
2
|
|
|
|
|
5
|
print join $EMPTY_STR, @{$errors[-1]->{'msg'}}, "\n"; |
|
2
|
|
|
|
|
13
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# Die for eval. |
39
|
|
|
|
|
|
|
} else { |
40
|
5
|
|
|
|
|
10
|
my $e = $errors[-1]->{'msg'}->[0]; |
41
|
5
|
|
|
|
|
29
|
die "$e\n"; |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
2
|
|
|
|
|
87
|
return; |
45
|
|
|
|
|
|
|
} |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
1; |
48
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
__END__ |