line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package StackTrace::Pretty::LogState; |
2
|
1
|
|
|
1
|
|
72130
|
use strict; |
|
1
|
|
|
|
|
11
|
|
|
1
|
|
|
|
|
29
|
|
3
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
22
|
|
4
|
1
|
|
|
1
|
|
15
|
use utf8; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
5
|
|
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
|
23123
|
my ($class) = @_; |
11
|
|
|
|
|
|
|
|
12
|
7
|
|
|
|
|
28
|
return bless { |
13
|
|
|
|
|
|
|
_is_in_stack_trace => 0, |
14
|
|
|
|
|
|
|
_line_num => 0, |
15
|
|
|
|
|
|
|
}, $class; |
16
|
|
|
|
|
|
|
} |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub read { |
19
|
12
|
|
|
12
|
0
|
4435
|
my ($self, $line) = @_; |
20
|
|
|
|
|
|
|
|
21
|
12
|
100
|
|
|
|
164
|
if ($line =~ $FIRST_LINE_ST_PATTERN) { |
|
|
100
|
|
|
|
|
|
22
|
4
|
|
|
|
|
9
|
$self->{_is_in_stack_trace} = 1; |
23
|
4
|
|
|
|
|
12
|
$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
|
|
|
|
|
14
|
$self->{_line_num}++; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
else { # Normal line |
30
|
3
|
|
|
|
|
6
|
$self->{_is_in_stack_trace} = 0; |
31
|
3
|
|
|
|
|
8
|
$self->{_line_num} = 0; |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
} |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
sub is_in_stack_trace { |
37
|
6
|
|
|
6
|
0
|
25
|
my ($self) = @_; |
38
|
|
|
|
|
|
|
|
39
|
6
|
|
|
|
|
29
|
return $self->{_is_in_stack_trace}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub line_num { |
43
|
3
|
|
|
3
|
0
|
13
|
my ($self) = @_; |
44
|
|
|
|
|
|
|
|
45
|
3
|
|
|
|
|
12
|
return $self->{_line_num}; |
46
|
|
|
|
|
|
|
} |
47
|
|
|
|
|
|
|
|
48
|
|
|
|
|
|
|
1; |