| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
|
|
2
|
|
|
|
|
|
|
# central hub of error handling |
|
3
|
|
|
|
|
|
|
|
|
4
|
|
|
|
|
|
|
package Graphics::Toolkit::Color::Error; |
|
5
|
|
|
|
|
|
|
|
|
6
|
52
|
|
|
52
|
|
284583
|
use v5.12; |
|
|
52
|
|
|
|
|
139
|
|
|
7
|
52
|
|
|
52
|
|
258
|
use warnings; |
|
|
52
|
|
|
|
|
103
|
|
|
|
52
|
|
|
|
|
2130
|
|
|
8
|
52
|
|
|
52
|
|
228
|
use Exporter; |
|
|
52
|
|
|
|
|
72
|
|
|
|
52
|
|
|
|
|
3854
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw/error/; |
|
11
|
52
|
|
|
52
|
|
363
|
use Carp; |
|
|
52
|
|
|
|
|
151
|
|
|
|
52
|
|
|
|
|
14712
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $mode = 'carp'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub change_mode { |
|
16
|
10
|
|
|
10
|
0
|
21
|
my ($new_mode) = @_; |
|
17
|
10
|
100
|
|
|
|
26
|
return unless defined $new_mode; |
|
18
|
5
|
|
|
|
|
9
|
$new_mode = lc $new_mode; |
|
19
|
5
|
50
|
100
|
|
|
27
|
return carp( "called for illegal error mode, setting it to carp" ) |
|
|
|
|
100
|
|
|
|
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
20
|
|
|
|
|
|
|
unless $new_mode eq 'carp' or $new_mode eq 'croak' or $new_mode eq 'quiet' |
|
21
|
|
|
|
|
|
|
or $new_mode eq 'say' or $new_mode eq 'die'; |
|
22
|
5
|
|
|
|
|
8
|
$mode = $new_mode; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub error { |
|
26
|
98
|
|
|
98
|
0
|
1797
|
my ($message) = @_; |
|
27
|
98
|
100
|
|
|
|
333
|
return 0 if $mode eq 'quiet'; |
|
28
|
97
|
|
|
|
|
251
|
my ($package, $filename, $line, $sub) = caller(1); |
|
29
|
97
|
|
|
|
|
3701
|
my $report = "$sub: $message"; |
|
30
|
97
|
100
|
|
|
|
285
|
if ($mode eq 'say') { say $report } |
|
|
1
|
100
|
|
|
|
3
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
6
|
elsif ($mode eq 'die') { die $report."\n" } |
|
32
|
94
|
|
|
|
|
1154
|
elsif ($mode eq 'carp'){ carp $report."\n" } |
|
33
|
1
|
|
|
|
|
9
|
elsif ($mode eq 'croak'){ croak $report."\n" } |
|
34
|
95
|
|
|
|
|
34277
|
return 0; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |