| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Copyrights 2007-2017 by [Mark Overmeer]. |
|
2
|
|
|
|
|
|
|
# For other contributors see ChangeLog. |
|
3
|
|
|
|
|
|
|
# See the manual pages for details on the licensing terms. |
|
4
|
|
|
|
|
|
|
# Pod stripped from pm file by OODoc 2.02. |
|
5
|
13
|
|
|
13
|
|
76
|
use warnings; |
|
|
13
|
|
|
|
|
27
|
|
|
|
13
|
|
|
|
|
356
|
|
|
6
|
13
|
|
|
13
|
|
59
|
use strict; |
|
|
13
|
|
|
|
|
24
|
|
|
|
13
|
|
|
|
|
318
|
|
|
7
|
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
package Log::Report::Exception; |
|
9
|
13
|
|
|
13
|
|
56
|
use vars '$VERSION'; |
|
|
13
|
|
|
|
|
26
|
|
|
|
13
|
|
|
|
|
554
|
|
|
10
|
|
|
|
|
|
|
$VERSION = '1.21'; |
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
|
|
13
|
13
|
|
|
13
|
|
71
|
use Log::Report 'log-report'; |
|
|
13
|
|
|
|
|
29
|
|
|
|
13
|
|
|
|
|
68
|
|
|
14
|
13
|
|
|
13
|
|
73
|
use Log::Report::Util qw/is_fatal to_html/; |
|
|
13
|
|
|
|
|
25
|
|
|
|
13
|
|
|
|
|
555
|
|
|
15
|
13
|
|
|
13
|
|
64
|
use POSIX qw/locale_h/; |
|
|
13
|
|
|
|
|
26
|
|
|
|
13
|
|
|
|
|
64
|
|
|
16
|
13
|
|
|
13
|
|
1392
|
use Scalar::Util qw/blessed/; |
|
|
13
|
|
|
|
|
25
|
|
|
|
13
|
|
|
|
|
767
|
|
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
use overload |
|
20
|
|
|
|
|
|
|
'""' => 'toString' |
|
21
|
14
|
|
|
14
|
|
40
|
, 'bool' => sub {1} # avoid accidental serialization of message |
|
22
|
13
|
|
|
13
|
|
67
|
, fallback => 1; |
|
|
13
|
|
|
|
|
21
|
|
|
|
13
|
|
|
|
|
87
|
|
|
23
|
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
sub new($@) |
|
26
|
16
|
|
|
16
|
1
|
60
|
{ my ($class, %args) = @_; |
|
27
|
16
|
|
50
|
|
|
42
|
$args{report_opts} ||= {}; |
|
28
|
16
|
|
|
|
|
123
|
bless \%args, $class; |
|
29
|
|
|
|
|
|
|
} |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
|
|
32
|
0
|
|
|
0
|
1
|
0
|
sub report_opts() {shift->{report_opts}} |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub reason(;$) |
|
36
|
7
|
|
|
7
|
1
|
1406
|
{ my $self = shift; |
|
37
|
7
|
50
|
|
|
|
33
|
@_ ? $self->{reason} = uc(shift) : $self->{reason}; |
|
38
|
|
|
|
|
|
|
} |
|
39
|
|
|
|
|
|
|
|
|
40
|
|
|
|
|
|
|
|
|
41
|
5
|
|
|
5
|
1
|
22
|
sub isFatal() { is_fatal shift->{reason} } |
|
42
|
|
|
|
|
|
|
|
|
43
|
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
sub message(;$) |
|
45
|
12
|
|
|
12
|
1
|
1556
|
{ my $self = shift; |
|
46
|
12
|
50
|
|
|
|
91
|
@_ or return $self->{message}; |
|
47
|
|
|
|
|
|
|
|
|
48
|
0
|
|
|
|
|
0
|
my $msg = shift; |
|
49
|
0
|
0
|
0
|
|
|
0
|
blessed $msg && $msg->isa('Log::Report::Message') |
|
50
|
|
|
|
|
|
|
or panic "message() of exception expects Log::Report::Message"; |
|
51
|
0
|
|
|
|
|
0
|
$self->{message} = $msg; |
|
52
|
|
|
|
|
|
|
} |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
|
|
55
|
2
|
|
|
2
|
1
|
7
|
sub inClass($) { $_[0]->message->inClass($_[1]) } |
|
56
|
|
|
|
|
|
|
|
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
sub throw(@) |
|
59
|
3
|
|
|
3
|
1
|
10
|
{ my $self = shift; |
|
60
|
3
|
100
|
|
|
|
11
|
my $opts = @_ ? { %{$self->{report_opts}}, @_ } : $self->{report_opts}; |
|
|
1
|
|
|
|
|
4
|
|
|
61
|
|
|
|
|
|
|
|
|
62
|
3
|
|
|
|
|
5
|
my $reason; |
|
63
|
3
|
100
|
|
|
|
9
|
if($reason = delete $opts->{reason}) |
|
64
|
1
|
|
|
|
|
3
|
{ $self->{reason} = $reason; |
|
65
|
|
|
|
|
|
|
$opts->{is_fatal} = is_fatal $reason |
|
66
|
1
|
50
|
|
|
|
5
|
unless exists $opts->{is_fatal}; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
else |
|
69
|
2
|
|
|
|
|
4
|
{ $reason = $self->{reason}; |
|
70
|
|
|
|
|
|
|
} |
|
71
|
|
|
|
|
|
|
|
|
72
|
3
|
|
66
|
|
|
21
|
$opts->{stack} ||= Log::Report::Dispatcher->collectStack; |
|
73
|
3
|
|
|
|
|
10
|
report $opts, $reason, $self; |
|
74
|
|
|
|
|
|
|
} |
|
75
|
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
# where the throw is handled is not interesting |
|
77
|
6
|
|
|
6
|
0
|
41
|
sub PROPAGATE($$) {shift} |
|
78
|
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
|
|
80
|
|
|
|
|
|
|
sub toString(;$) |
|
81
|
2
|
|
|
2
|
1
|
539
|
{ my ($self, $locale) = @_; |
|
82
|
2
|
|
|
|
|
8
|
my $msg = $self->message; |
|
83
|
2
|
50
|
|
|
|
15
|
lc($self->{reason}).': '.(ref $msg ? $msg->toString($locale) : $msg)."\n"; |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
|
|
87
|
0
|
|
|
0
|
1
|
|
sub toHTML(;$) { to_html($_[0]->toString($_[1])) } |
|
88
|
|
|
|
|
|
|
|
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
sub print(;$) |
|
91
|
0
|
|
|
0
|
1
|
|
{ my $self = shift; |
|
92
|
0
|
|
0
|
|
|
|
(shift || *STDERR)->print($self->toString); |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
1; |