line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test2::Workflow::BlockBase; |
2
|
49
|
|
|
49
|
|
128910
|
use strict; |
|
49
|
|
|
|
|
51
|
|
|
49
|
|
|
|
|
1011
|
|
3
|
49
|
|
|
49
|
|
134
|
use warnings; |
|
49
|
|
|
|
|
39
|
|
|
49
|
|
|
|
|
1040
|
|
4
|
|
|
|
|
|
|
|
5
|
49
|
|
|
49
|
|
149
|
use Test2::Util::HashBase qw/code frame _info _lines/; |
|
49
|
|
|
|
|
51
|
|
|
49
|
|
|
|
|
266
|
|
6
|
49
|
|
|
49
|
|
6219
|
use Sub::Info qw/sub_info/; |
|
49
|
|
|
|
|
59
|
|
|
49
|
|
|
|
|
306
|
|
7
|
49
|
|
|
49
|
|
1165
|
use List::Util qw/min max/; |
|
49
|
|
|
|
|
51
|
|
|
49
|
|
|
|
|
2472
|
|
8
|
49
|
|
|
49
|
|
159
|
use Carp qw/croak/; |
|
49
|
|
|
|
|
48
|
|
|
49
|
|
|
|
|
1918
|
|
9
|
|
|
|
|
|
|
|
10
|
49
|
|
|
49
|
|
183
|
use Test2::Util::Trace(); |
|
49
|
|
|
|
|
48
|
|
|
49
|
|
|
|
|
6305
|
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
BEGIN { |
13
|
49
|
|
|
49
|
|
282
|
local ($@, $!, $SIG{__DIE__}); |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
my $set_name = eval { require Sub::Util; Sub::Util->can('set_subname') } |
16
|
49
|
|
33
|
|
|
57
|
|| eval { require Sub::Name; Sub::Name->can('subname') }; |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
*set_subname = $set_name ? sub { |
19
|
1300
|
|
|
1300
|
|
1058
|
my $self = shift; |
20
|
1300
|
|
|
|
|
1218
|
my ($name) = @_; |
21
|
|
|
|
|
|
|
|
22
|
1300
|
|
|
|
|
5891
|
$set_name->($name, $self->{+CODE}); |
23
|
1300
|
|
|
|
|
1354
|
delete $self->{+_INFO}; |
24
|
|
|
|
|
|
|
|
25
|
1300
|
|
|
|
|
1846
|
return 1; |
26
|
49
|
50
|
|
|
|
18288
|
} : sub { return 0 }; |
|
0
|
|
|
|
|
0
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub init { |
30
|
1300
|
|
|
1300
|
0
|
971
|
my $self = shift; |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
croak "The 'code' attribute is required" |
33
|
1300
|
50
|
|
|
|
2078
|
unless $self->{+CODE}; |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
croak "The 'frame' attribute is required" |
36
|
1300
|
50
|
|
|
|
1795
|
unless $self->{+FRAME}; |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
$self->{+_LINES} = delete $self->{lines} |
39
|
1300
|
50
|
|
|
|
3013
|
if $self->{lines}; |
40
|
|
|
|
|
|
|
} |
41
|
|
|
|
|
|
|
|
42
|
0
|
|
|
0
|
0
|
0
|
sub file { shift->info->{file} } |
43
|
203
|
|
|
203
|
0
|
232
|
sub lines { shift->info->{lines} } |
44
|
1300
|
|
|
1300
|
0
|
2053
|
sub package { shift->info->{package} } |
45
|
351
|
|
|
351
|
0
|
406
|
sub subname { shift->info->{name} } |
46
|
|
|
|
|
|
|
|
47
|
|
|
|
|
|
|
sub info { |
48
|
1854
|
|
|
1854
|
0
|
1381
|
my $self = shift; |
49
|
|
|
|
|
|
|
|
50
|
1854
|
100
|
|
|
|
2831
|
unless ($self->{+_INFO}) { |
51
|
1419
|
|
|
|
|
2580
|
my $info = sub_info($self->code); |
52
|
|
|
|
|
|
|
|
53
|
1419
|
|
|
|
|
123377
|
my $frame = $self->frame; |
54
|
1419
|
|
|
|
|
3221
|
my $file = $info->{file}; |
55
|
1419
|
|
|
|
|
1184
|
my $all_lines = $info->{all_lines}; |
56
|
1419
|
|
|
|
|
1294
|
my $pre_lines = $self->{+_LINES}; |
57
|
1419
|
|
50
|
|
|
2499
|
my $lines = $info->{lines} ||= []; |
58
|
|
|
|
|
|
|
|
59
|
1419
|
50
|
33
|
|
|
2649
|
if ($pre_lines && @$pre_lines) { |
60
|
0
|
|
|
|
|
0
|
@$lines = @$pre_lines; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
else { |
63
|
1419
|
100
|
|
|
|
5272
|
@$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
|
|
|
|
2724
|
$lines->[0]-- if $lines->[0] != $lines->[1]; |
71
|
|
|
|
|
|
|
|
72
|
1419
|
|
|
|
|
2070
|
$self->{+_INFO} = $info; |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
|
75
|
1854
|
|
|
|
|
5636
|
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__ |