line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package StackTrace::Pretty::LogState; |
2
|
1
|
|
|
1
|
|
72576
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
27
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
23
|
|
4
|
1
|
|
|
1
|
|
15
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
4
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
my $FIRST_LINE_ST_PATTERN = qr/^\S.* at \S+ line \d+\.$/; |
7
|
|
|
|
|
|
|
my $CHILD_LINE_ST_PATTERN = qr/\S+ called at \S+ line \d+\.?$/; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
7
|
|
|
7
|
0
|
23382
|
my ($class) = @_; |
11
|
|
|
|
|
|
|
|
12
|
7
|
|
|
|
|
38
|
return bless { |
13
|
|
|
|
|
|
|
_is_in_stack_trace => 0, |
14
|
|
|
|
|
|
|
_line_num => 0, |
15
|
|
|
|
|
|
|
}, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub read { |
19
|
12
|
|
|
12
|
0
|
4443
|
my ($self, $line) = @_; |
20
|
|
|
|
|
|
|
|
21
|
12
|
100
|
|
|
|
159
|
if ($line =~ $FIRST_LINE_ST_PATTERN) { |
|
|
100
|
|
|
|
|
|
22
|
4
|
|
|
|
|
9
|
$self->{_is_in_stack_trace} = 1; |
23
|
4
|
|
|
|
|
11
|
$self->{_line_num} = 0; # Reset |
24
|
|
|
|
|
|
|
} |
25
|
|
|
|
|
|
|
elsif ($line =~ $CHILD_LINE_ST_PATTERN) { |
26
|
5
|
|
|
|
|
11
|
$self->{_is_in_stack_trace} = 1; # Unchanged |
27
|
5
|
|
|
|
|
20
|
$self->{_line_num}++; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { # Normal line |
30
|
3
|
|
|
|
|
6
|
$self->{_is_in_stack_trace} = 0; |
31
|
3
|
|
|
|
|
9
|
$self->{_line_num} = 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_in_stack_trace { |
37
|
6
|
|
|
6
|
0
|
29
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
31
|
return $self->{_is_in_stack_trace}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub line_num { |
43
|
3
|
|
|
3
|
0
|
26
|
my ($self) = @_; |
44
|
|
|
|
|
|
|
|
45
|
3
|
|
|
|
|
13
|
return $self->{_line_num}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |