line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Examine::Subs::Postprocessor; |
2
|
57
|
|
|
57
|
|
837
|
use 5.008; |
|
57
|
|
|
|
|
144
|
|
3
|
57
|
|
|
57
|
|
198
|
use strict; |
|
57
|
|
|
|
|
60
|
|
|
57
|
|
|
|
|
957
|
|
4
|
57
|
|
|
57
|
|
163
|
use warnings; |
|
57
|
|
|
|
|
59
|
|
|
57
|
|
|
|
|
1831
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.68'; |
7
|
|
|
|
|
|
|
|
8
|
57
|
|
|
57
|
|
190
|
use Carp; |
|
57
|
|
|
|
|
59
|
|
|
57
|
|
|
|
|
2664
|
|
9
|
57
|
|
|
57
|
|
194
|
use Data::Dumper; |
|
57
|
|
|
|
|
62
|
|
|
57
|
|
|
|
|
4662
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# we need to do some trickery for DTS due to circular referencing, |
14
|
|
|
|
|
|
|
# which broke CPAN installs. |
15
|
|
|
|
|
|
|
|
16
|
57
|
|
|
57
|
|
79
|
eval { |
17
|
57
|
|
|
|
|
8808
|
require Devel::Trace::Subs; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
57
|
|
|
|
|
173
|
eval { |
21
|
57
|
|
|
|
|
177
|
import Devel::Trace::Subs qw(trace); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
57
|
50
|
|
|
|
222
|
if (! defined &trace){ |
25
|
57
|
|
|
8
|
|
41759
|
*trace = sub {}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
|
|
|
|
|
|
|
31
|
145
|
100
|
|
145
|
0
|
1571
|
trace() if $ENV{TRACE}; |
32
|
|
|
|
|
|
|
|
33
|
144
|
|
|
|
|
225
|
my $self = {}; |
34
|
144
|
|
|
|
|
256
|
bless $self, shift; |
35
|
|
|
|
|
|
|
|
36
|
144
|
|
|
|
|
167
|
my $struct = shift; |
37
|
|
|
|
|
|
|
|
38
|
144
|
|
|
|
|
344
|
$self->{post_procs} = $self->_dt(); |
39
|
|
|
|
|
|
|
|
40
|
144
|
|
|
|
|
303
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
sub _dt { |
43
|
|
|
|
|
|
|
|
44
|
148
|
100
|
|
148
|
|
1315
|
trace() if $ENV{TRACE}; |
45
|
|
|
|
|
|
|
|
46
|
147
|
|
|
|
|
183
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
147
|
|
|
|
|
1016
|
my $dt = { |
49
|
|
|
|
|
|
|
file_lines_contain => \&file_lines_contain, |
50
|
|
|
|
|
|
|
subs => \&subs, |
51
|
|
|
|
|
|
|
objects => \&objects, |
52
|
|
|
|
|
|
|
_default => \&_default, |
53
|
|
|
|
|
|
|
_test => \&_test, |
54
|
|
|
|
|
|
|
_test_bad => \&_test_bad, |
55
|
|
|
|
|
|
|
end_of_last_sub => \&end_of_last_sub, |
56
|
|
|
|
|
|
|
}; |
57
|
|
|
|
|
|
|
|
58
|
147
|
|
|
|
|
434
|
return $dt; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
sub exists { |
61
|
|
|
|
|
|
|
|
62
|
141
|
100
|
|
141
|
1
|
1183
|
trace() if $ENV{TRACE}; |
63
|
|
|
|
|
|
|
|
64
|
140
|
|
|
|
|
168
|
my $self = shift; |
65
|
140
|
|
|
|
|
178
|
my $string = shift; |
66
|
|
|
|
|
|
|
|
67
|
140
|
100
|
|
|
|
359
|
if (exists $self->{post_procs}{$string}){ |
68
|
136
|
|
|
|
|
2525
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
4
|
|
|
|
|
13
|
return 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
sub subs { |
75
|
|
|
|
|
|
|
|
76
|
45
|
100
|
|
45
|
1
|
1031
|
trace() if $ENV{TRACE}; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return sub { |
79
|
|
|
|
|
|
|
|
80
|
42
|
50
|
|
42
|
|
144
|
trace() if $ENV{TRACE}; |
81
|
|
|
|
|
|
|
|
82
|
42
|
|
|
|
|
67
|
my $p = shift; |
83
|
42
|
|
|
|
|
57
|
my $struct = shift; |
84
|
|
|
|
|
|
|
|
85
|
42
|
|
|
|
|
57
|
my $s = $struct; |
86
|
42
|
|
|
|
|
48
|
my @subs; |
87
|
|
|
|
|
|
|
|
88
|
42
|
|
|
|
|
141
|
for my $f (keys %$s){ |
89
|
|
|
|
|
|
|
|
90
|
41
|
|
|
|
|
50
|
for my $sub (keys %{$s->{$f}{subs}}){ |
|
41
|
|
|
|
|
203
|
|
91
|
348
|
|
|
|
|
349
|
$s->{$f}{subs}{$sub}{start}++; |
92
|
348
|
|
|
|
|
275
|
$s->{$f}{subs}{$sub}{end}++; |
93
|
348
|
|
|
|
|
338
|
$s->{$f}{subs}{$sub}{name} = $sub; |
94
|
348
|
|
|
|
|
235
|
@{ $s->{$f}{subs}{$sub}{code} } = @{ $s->{$f}{subs}{$sub}{code} }; |
|
348
|
|
|
|
|
1354
|
|
|
348
|
|
|
|
|
402
|
|
95
|
348
|
|
|
|
|
532
|
push @subs, $s->{$f}{subs}{$sub}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
42
|
|
|
|
|
116
|
return \@subs; |
99
|
44
|
|
|
|
|
258
|
}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
sub file_lines_contain { |
102
|
|
|
|
|
|
|
|
103
|
73
|
100
|
|
73
|
1
|
1036
|
trace() if $ENV{TRACE}; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return sub { |
106
|
|
|
|
|
|
|
|
107
|
71
|
100
|
|
71
|
|
198
|
trace() if $ENV{TRACE}; |
108
|
|
|
|
|
|
|
|
109
|
71
|
|
|
|
|
109
|
my $p = shift; |
110
|
71
|
|
|
|
|
89
|
my $struct = shift; |
111
|
|
|
|
|
|
|
|
112
|
71
|
|
|
|
|
122
|
my $search = $p->{search}; |
113
|
|
|
|
|
|
|
|
114
|
71
|
100
|
100
|
|
|
369
|
if ($search && ! $p->{regex}){ |
115
|
4
|
|
|
|
|
11
|
$search = "\Q$search"; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
71
|
|
|
|
|
109
|
my $s = $struct; |
119
|
|
|
|
|
|
|
|
120
|
71
|
100
|
|
|
|
187
|
if (not $search){ |
121
|
26
|
|
|
|
|
65
|
return $struct; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
45
|
|
|
|
|
150
|
for my $f (keys %$s){ |
125
|
45
|
|
|
|
|
51
|
for my $sub (keys %{$s->{$f}{subs}}){ |
|
45
|
|
|
|
|
194
|
|
126
|
423
|
|
|
|
|
305
|
my $found = 0; |
127
|
423
|
|
|
|
|
258
|
my @has; |
128
|
423
|
|
|
|
|
278
|
for (@{$s->{$f}{subs}{$sub}{code}}){ |
|
423
|
|
|
|
|
655
|
|
129
|
2178
|
100
|
100
|
|
|
6284
|
if ($_ and /$search/){ |
130
|
181
|
|
|
|
|
145
|
$found++; |
131
|
181
|
|
|
|
|
235
|
push @has, $_; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
423
|
100
|
|
|
|
587
|
if (! $found){ |
135
|
253
|
|
|
|
|
403
|
delete $s->{$f}{subs}{$sub}; |
136
|
253
|
|
|
|
|
288
|
next; |
137
|
|
|
|
|
|
|
} |
138
|
170
|
|
|
|
|
356
|
$s->{$f}{subs}{$sub}{code} = \@has; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
45
|
|
|
|
|
128
|
return $struct; |
142
|
72
|
|
|
|
|
495
|
}; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
sub end_of_last_sub { |
145
|
|
|
|
|
|
|
|
146
|
6
|
100
|
|
6
|
1
|
481
|
trace() if $ENV{TRACE}; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
return sub { |
149
|
|
|
|
|
|
|
|
150
|
4
|
50
|
|
4
|
|
12
|
trace() if $ENV{TRACE}; |
151
|
|
|
|
|
|
|
|
152
|
4
|
|
|
|
|
6
|
my $p = shift; |
153
|
4
|
|
|
|
|
6
|
my $struct = shift; |
154
|
|
|
|
|
|
|
|
155
|
4
|
|
|
|
|
4
|
my @last_line_nums; |
156
|
|
|
|
|
|
|
|
157
|
4
|
|
|
|
|
8
|
for my $sub (@$struct){ |
158
|
43
|
|
|
|
|
42
|
push @last_line_nums, $sub->{end}; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
4
|
|
|
|
|
25
|
@last_line_nums = sort {$a<=>$b} @last_line_nums; |
|
103
|
|
|
|
|
74
|
|
162
|
|
|
|
|
|
|
|
163
|
4
|
|
|
|
|
10
|
return $last_line_nums[-1]; |
164
|
|
|
|
|
|
|
|
165
|
5
|
|
|
|
|
1193
|
}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
sub _test { |
168
|
|
|
|
|
|
|
|
169
|
4
|
100
|
|
4
|
|
743
|
trace() if $ENV{TRACE}; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
return sub { |
172
|
|
|
|
|
|
|
|
173
|
1
|
50
|
|
1
|
|
4
|
trace() if $ENV{TRACE}; |
174
|
1
|
|
|
|
|
1
|
my $p = shift; |
175
|
1
|
|
|
|
|
1
|
my $struct = shift; |
176
|
1
|
|
|
|
|
2
|
return $struct; |
177
|
3
|
|
|
|
|
15
|
}; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
sub objects { |
180
|
|
|
|
|
|
|
|
181
|
18
|
100
|
|
18
|
0
|
804
|
trace() if $ENV{TRACE}; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# uses 'subs' post_proc |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
return sub { |
186
|
|
|
|
|
|
|
|
187
|
16
|
50
|
|
16
|
|
40
|
trace() if $ENV{TRACE}; |
188
|
|
|
|
|
|
|
|
189
|
16
|
|
|
|
|
30
|
my $p = shift; |
190
|
16
|
|
|
|
|
18
|
my $struct = shift; |
191
|
|
|
|
|
|
|
|
192
|
16
|
|
|
|
|
23
|
my @return; |
193
|
|
|
|
|
|
|
|
194
|
16
|
50
|
|
|
|
49
|
return if not ref($struct) eq 'ARRAY'; |
195
|
|
|
|
|
|
|
|
196
|
16
|
|
|
|
|
22
|
my $file = $p->{file}; |
197
|
16
|
|
|
|
|
19
|
my $search = $p->{search}; |
198
|
|
|
|
|
|
|
|
199
|
16
|
100
|
100
|
|
|
66
|
if ($search && ! $p->{regex}){ |
200
|
1
|
|
|
|
|
3
|
$search = "\Q$search"; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
16
|
|
|
|
|
20
|
my $lines; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
my $des_sub; |
206
|
|
|
|
|
|
|
|
207
|
16
|
|
|
|
|
28
|
for my $sub (@$struct){ |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
$des_sub |
210
|
91
|
|
|
|
|
243
|
= Devel::Examine::Subs::Sub->new($sub, $sub->{name}); |
211
|
|
|
|
|
|
|
|
212
|
91
|
|
|
|
|
99
|
push @return, $des_sub; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
16
|
|
|
|
|
44
|
return \@return; |
216
|
17
|
|
|
|
|
77
|
}; |
217
|
|
|
|
|
|
|
} |
218
|
1
|
|
|
1
|
|
3
|
sub _vim_placeholder {1;} |
219
|
|
|
|
|
|
|
1; |
220
|
|
|
|
|
|
|
__END__ |