| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
package Test2::Workflow::BlockBase; |
|
2
|
49
|
|
|
49
|
|
102250
|
use strict; |
|
|
49
|
|
|
|
|
58
|
|
|
|
49
|
|
|
|
|
1056
|
|
|
3
|
49
|
|
|
49
|
|
149
|
use warnings; |
|
|
49
|
|
|
|
|
50
|
|
|
|
49
|
|
|
|
|
1070
|
|
|
4
|
|
|
|
|
|
|
|
|
5
|
49
|
|
|
49
|
|
156
|
use Test2::Util::HashBase qw/code frame _info _lines/; |
|
|
49
|
|
|
|
|
49
|
|
|
|
49
|
|
|
|
|
273
|
|
|
6
|
49
|
|
|
49
|
|
6036
|
use Test2::Util::Sub qw/sub_info/; |
|
|
49
|
|
|
|
|
58
|
|
|
|
49
|
|
|
|
|
2039
|
|
|
7
|
49
|
|
|
49
|
|
172
|
use List::Util qw/min max/; |
|
|
49
|
|
|
|
|
51
|
|
|
|
49
|
|
|
|
|
2144
|
|
|
8
|
49
|
|
|
49
|
|
163
|
use Carp qw/croak/; |
|
|
49
|
|
|
|
|
103
|
|
|
|
49
|
|
|
|
|
1638
|
|
|
9
|
|
|
|
|
|
|
|
|
10
|
49
|
|
|
49
|
|
180
|
use Test2::Util::Trace(); |
|
|
49
|
|
|
|
|
49
|
|
|
|
49
|
|
|
|
|
6634
|
|
|
11
|
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
|
13
|
49
|
|
|
49
|
|
697
|
local ($@, $!, $SIG{__DIE__}); |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $set_name = eval { require Sub::Util; Sub::Util->can('set_subname') } |
|
16
|
49
|
|
33
|
|
|
70
|
|| eval { require Sub::Name; Sub::Name->can('subname') }; |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
*set_subname = $set_name ? sub { |
|
19
|
1300
|
|
|
1300
|
|
1176
|
my $self = shift; |
|
20
|
1300
|
|
|
|
|
1106
|
my ($name) = @_; |
|
21
|
|
|
|
|
|
|
|
|
22
|
1300
|
|
|
|
|
5843
|
$set_name->($name, $self->{+CODE}); |
|
23
|
1300
|
|
|
|
|
1266
|
delete $self->{+_INFO}; |
|
24
|
|
|
|
|
|
|
|
|
25
|
1300
|
|
|
|
|
1915
|
return 1; |
|
26
|
49
|
50
|
|
|
|
20588
|
} : sub { return 0 }; |
|
|
0
|
|
|
|
|
0
|
|
|
27
|
|
|
|
|
|
|
} |
|
28
|
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub init { |
|
30
|
1300
|
|
|
1300
|
0
|
980
|
my $self = shift; |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
croak "The 'code' attribute is required" |
|
33
|
1300
|
50
|
|
|
|
2204
|
unless $self->{+CODE}; |
|
34
|
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
croak "The 'frame' attribute is required" |
|
36
|
1300
|
50
|
|
|
|
1737
|
unless $self->{+FRAME}; |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$self->{+_LINES} = delete $self->{lines} |
|
39
|
1300
|
50
|
|
|
|
2819
|
if $self->{lines}; |
|
40
|
|
|
|
|
|
|
} |
|
41
|
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
0
|
0
|
sub file { shift->info->{file} } |
|
43
|
203
|
|
|
203
|
0
|
198
|
sub lines { shift->info->{lines} } |
|
44
|
1300
|
|
|
1300
|
0
|
1901
|
sub package { shift->info->{package} } |
|
45
|
351
|
|
|
351
|
0
|
367
|
sub subname { shift->info->{name} } |
|
46
|
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub info { |
|
48
|
1854
|
|
|
1854
|
0
|
1411
|
my $self = shift; |
|
49
|
|
|
|
|
|
|
|
|
50
|
1854
|
100
|
|
|
|
2539
|
unless ($self->{+_INFO}) { |
|
51
|
1419
|
|
|
|
|
2400
|
my $info = sub_info($self->code); |
|
52
|
|
|
|
|
|
|
|
|
53
|
1419
|
|
|
|
|
118118
|
my $frame = $self->frame; |
|
54
|
1419
|
|
|
|
|
3042
|
my $file = $info->{file}; |
|
55
|
1419
|
|
|
|
|
1168
|
my $all_lines = $info->{all_lines}; |
|
56
|
1419
|
|
|
|
|
1158
|
my $pre_lines = $self->{+_LINES}; |
|
57
|
1419
|
|
50
|
|
|
2361
|
my $lines = $info->{lines} ||= []; |
|
58
|
|
|
|
|
|
|
|
|
59
|
1419
|
50
|
33
|
|
|
2611
|
if ($pre_lines && @$pre_lines) { |
|
60
|
0
|
|
|
|
|
0
|
@$lines = @$pre_lines; |
|
61
|
|
|
|
|
|
|
} |
|
62
|
|
|
|
|
|
|
else { |
|
63
|
1419
|
100
|
|
|
|
5212
|
@$lines = ( |
|
64
|
|
|
|
|
|
|
min(@$all_lines, $frame->[2]), |
|
65
|
|
|
|
|
|
|
max(@$all_lines, $frame->[2]), |
|
66
|
|
|
|
|
|
|
) if $frame->[1] eq $file; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
|
|
|
|
|
|
|
|
69
|
|
|
|
|
|
|
# Adjust for start |
|
70
|
1419
|
100
|
|
|
|
2257
|
$lines->[0]-- if $lines->[0] != $lines->[1]; |
|
71
|
|
|
|
|
|
|
|
|
72
|
1419
|
|
|
|
|
1828
|
$self->{+_INFO} = $info; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
1854
|
|
|
|
|
5374
|
return $self->{+_INFO}; |
|
76
|
|
|
|
|
|
|
} |
|
77
|
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
sub trace { |
|
79
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
80
|
0
|
|
|
|
|
|
return Test2::Util::Trace->new( |
|
81
|
|
|
|
|
|
|
frame => $self->frame, |
|
82
|
|
|
|
|
|
|
detail => $self->debug, |
|
83
|
|
|
|
|
|
|
); |
|
84
|
|
|
|
|
|
|
} |
|
85
|
|
|
|
|
|
|
|
|
86
|
|
|
|
|
|
|
sub debug { |
|
87
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
88
|
0
|
|
|
|
|
|
my $file = $self->file; |
|
89
|
0
|
|
|
|
|
|
my $lines = $self->lines; |
|
90
|
|
|
|
|
|
|
|
|
91
|
0
|
0
|
|
|
|
|
my $line_str = @$lines == 1 ? "around line $lines->[0]" : "around lines $lines->[0] -> $lines->[1]"; |
|
92
|
0
|
|
|
|
|
|
return "at $file $line_str."; |
|
93
|
|
|
|
|
|
|
} |
|
94
|
|
|
|
|
|
|
|
|
95
|
|
|
|
|
|
|
sub throw { |
|
96
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
|
97
|
0
|
|
|
|
|
|
my ($msg) = @_; |
|
98
|
0
|
|
|
|
|
|
die "$msg " . $self->debug . "\n"; |
|
99
|
|
|
|
|
|
|
} |
|
100
|
|
|
|
|
|
|
|
|
101
|
|
|
|
|
|
|
1; |
|
102
|
|
|
|
|
|
|
|
|
103
|
|
|
|
|
|
|
__END__ |