| 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
|
|
349891
|
use v5.12; |
|
|
52
|
|
|
|
|
140
|
|
|
7
|
52
|
|
|
52
|
|
277
|
use warnings; |
|
|
52
|
|
|
|
|
95
|
|
|
|
52
|
|
|
|
|
2209
|
|
|
8
|
52
|
|
|
52
|
|
236
|
use Exporter; |
|
|
52
|
|
|
|
|
90
|
|
|
|
52
|
|
|
|
|
3859
|
|
|
9
|
|
|
|
|
|
|
our @ISA = qw(Exporter); |
|
10
|
|
|
|
|
|
|
our @EXPORT_OK = qw/error/; |
|
11
|
52
|
|
|
52
|
|
382
|
use Carp; |
|
|
52
|
|
|
|
|
117
|
|
|
|
52
|
|
|
|
|
14408
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
my $mode = 'carp'; |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub change_mode { |
|
16
|
10
|
|
|
10
|
0
|
28
|
my ($new_mode) = @_; |
|
17
|
10
|
100
|
|
|
|
30
|
return unless defined $new_mode; |
|
18
|
5
|
|
|
|
|
9
|
$new_mode = lc $new_mode; |
|
19
|
5
|
50
|
100
|
|
|
47
|
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
|
|
|
|
|
11
|
$mode = $new_mode; |
|
23
|
|
|
|
|
|
|
} |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub error { |
|
26
|
98
|
|
|
98
|
0
|
3189
|
my ($message) = @_; |
|
27
|
98
|
100
|
|
|
|
219
|
return 0 if $mode eq 'quiet'; |
|
28
|
97
|
|
|
|
|
255
|
my ($package, $filename, $line, $sub) = caller(1); |
|
29
|
97
|
|
|
|
|
3395
|
my $report = "$sub: $message"; |
|
30
|
97
|
100
|
|
|
|
261
|
if ($mode eq 'say') { say $report } |
|
|
1
|
100
|
|
|
|
4
|
|
|
|
|
100
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
31
|
1
|
|
|
|
|
7
|
elsif ($mode eq 'die') { die $report."\n" } |
|
32
|
94
|
|
|
|
|
1081
|
elsif ($mode eq 'carp'){ carp $report."\n" } |
|
33
|
1
|
|
|
|
|
13
|
elsif ($mode eq 'croak'){ croak $report."\n" } |
|
34
|
95
|
|
|
|
|
33442
|
return 0; |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
1; |