line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Devel::Examine::Subs::Postprocessor; |
2
|
58
|
|
|
58
|
|
843
|
use 5.008; |
|
58
|
|
|
|
|
120
|
|
3
|
58
|
|
|
58
|
|
191
|
use strict; |
|
58
|
|
|
|
|
49
|
|
|
58
|
|
|
|
|
903
|
|
4
|
58
|
|
|
58
|
|
178
|
use warnings; |
|
58
|
|
|
|
|
55
|
|
|
58
|
|
|
|
|
1878
|
|
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
our $VERSION = '1.69'; |
7
|
|
|
|
|
|
|
|
8
|
58
|
|
|
58
|
|
180
|
use Carp; |
|
58
|
|
|
|
|
65
|
|
|
58
|
|
|
|
|
2511
|
|
9
|
58
|
|
|
58
|
|
188
|
use Data::Dumper; |
|
58
|
|
|
|
|
54
|
|
|
58
|
|
|
|
|
4553
|
|
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
BEGIN { |
12
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
# we need to do some trickery for DTS due to circular referencing, |
14
|
|
|
|
|
|
|
# which broke CPAN installs. |
15
|
|
|
|
|
|
|
|
16
|
58
|
|
|
58
|
|
79
|
eval { |
17
|
58
|
|
|
|
|
8716
|
require Devel::Trace::Subs; |
18
|
|
|
|
|
|
|
}; |
19
|
|
|
|
|
|
|
|
20
|
58
|
|
|
|
|
147
|
eval { |
21
|
58
|
|
|
|
|
172
|
import Devel::Trace::Subs qw(trace); |
22
|
|
|
|
|
|
|
}; |
23
|
|
|
|
|
|
|
|
24
|
58
|
50
|
|
|
|
208
|
if (! defined &trace){ |
25
|
58
|
|
|
8
|
|
39848
|
*trace = sub {}; |
26
|
|
|
|
|
|
|
} |
27
|
|
|
|
|
|
|
}; |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
sub new { |
30
|
|
|
|
|
|
|
|
31
|
146
|
100
|
|
146
|
0
|
1732
|
trace() if $ENV{TRACE}; |
32
|
|
|
|
|
|
|
|
33
|
145
|
|
|
|
|
209
|
my $self = {}; |
34
|
145
|
|
|
|
|
240
|
bless $self, shift; |
35
|
|
|
|
|
|
|
|
36
|
145
|
|
|
|
|
157
|
my $struct = shift; |
37
|
|
|
|
|
|
|
|
38
|
145
|
|
|
|
|
308
|
$self->{post_procs} = $self->_dt(); |
39
|
|
|
|
|
|
|
|
40
|
145
|
|
|
|
|
256
|
return $self; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
sub _dt { |
43
|
|
|
|
|
|
|
|
44
|
149
|
100
|
|
149
|
|
1249
|
trace() if $ENV{TRACE}; |
45
|
|
|
|
|
|
|
|
46
|
148
|
|
|
|
|
180
|
my $self = shift; |
47
|
|
|
|
|
|
|
|
48
|
148
|
|
|
|
|
956
|
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
|
148
|
|
|
|
|
408
|
return $dt; |
59
|
|
|
|
|
|
|
} |
60
|
|
|
|
|
|
|
sub exists { |
61
|
|
|
|
|
|
|
|
62
|
142
|
100
|
|
142
|
1
|
1103
|
trace() if $ENV{TRACE}; |
63
|
|
|
|
|
|
|
|
64
|
141
|
|
|
|
|
147
|
my $self = shift; |
65
|
141
|
|
|
|
|
170
|
my $string = shift; |
66
|
|
|
|
|
|
|
|
67
|
141
|
100
|
|
|
|
300
|
if (exists $self->{post_procs}{$string}){ |
68
|
137
|
|
|
|
|
2716
|
return 1; |
69
|
|
|
|
|
|
|
} |
70
|
|
|
|
|
|
|
else { |
71
|
4
|
|
|
|
|
16
|
return 0; |
72
|
|
|
|
|
|
|
} |
73
|
|
|
|
|
|
|
} |
74
|
|
|
|
|
|
|
sub subs { |
75
|
|
|
|
|
|
|
|
76
|
46
|
100
|
|
46
|
1
|
1023
|
trace() if $ENV{TRACE}; |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
return sub { |
79
|
|
|
|
|
|
|
|
80
|
43
|
50
|
|
43
|
|
103
|
trace() if $ENV{TRACE}; |
81
|
|
|
|
|
|
|
|
82
|
43
|
|
|
|
|
57
|
my $p = shift; |
83
|
43
|
|
|
|
|
52
|
my $struct = shift; |
84
|
|
|
|
|
|
|
|
85
|
43
|
|
|
|
|
46
|
my $s = $struct; |
86
|
43
|
|
|
|
|
51
|
my @subs; |
87
|
|
|
|
|
|
|
|
88
|
43
|
|
|
|
|
121
|
for my $f (keys %$s){ |
89
|
|
|
|
|
|
|
|
90
|
42
|
|
|
|
|
46
|
for my $sub (keys %{$s->{$f}{subs}}){ |
|
42
|
|
|
|
|
203
|
|
91
|
350
|
|
|
|
|
329
|
$s->{$f}{subs}{$sub}{start}++; |
92
|
350
|
|
|
|
|
276
|
$s->{$f}{subs}{$sub}{end}++; |
93
|
350
|
|
|
|
|
357
|
$s->{$f}{subs}{$sub}{name} = $sub; |
94
|
350
|
|
|
|
|
210
|
@{ $s->{$f}{subs}{$sub}{code} } = @{ $s->{$f}{subs}{$sub}{code} }; |
|
350
|
|
|
|
|
1336
|
|
|
350
|
|
|
|
|
385
|
|
95
|
350
|
|
|
|
|
566
|
push @subs, $s->{$f}{subs}{$sub}; |
96
|
|
|
|
|
|
|
} |
97
|
|
|
|
|
|
|
} |
98
|
43
|
|
|
|
|
111
|
return \@subs; |
99
|
45
|
|
|
|
|
238
|
}; |
100
|
|
|
|
|
|
|
} |
101
|
|
|
|
|
|
|
sub file_lines_contain { |
102
|
|
|
|
|
|
|
|
103
|
73
|
100
|
|
73
|
1
|
1086
|
trace() if $ENV{TRACE}; |
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
return sub { |
106
|
|
|
|
|
|
|
|
107
|
71
|
100
|
|
71
|
|
195
|
trace() if $ENV{TRACE}; |
108
|
|
|
|
|
|
|
|
109
|
71
|
|
|
|
|
92
|
my $p = shift; |
110
|
71
|
|
|
|
|
94
|
my $struct = shift; |
111
|
|
|
|
|
|
|
|
112
|
71
|
|
|
|
|
106
|
my $search = $p->{search}; |
113
|
|
|
|
|
|
|
|
114
|
71
|
100
|
100
|
|
|
365
|
if ($search && ! $p->{regex}){ |
115
|
4
|
|
|
|
|
11
|
$search = "\Q$search"; |
116
|
|
|
|
|
|
|
} |
117
|
|
|
|
|
|
|
|
118
|
71
|
|
|
|
|
94
|
my $s = $struct; |
119
|
|
|
|
|
|
|
|
120
|
71
|
100
|
|
|
|
178
|
if (not $search){ |
121
|
26
|
|
|
|
|
60
|
return $struct; |
122
|
|
|
|
|
|
|
} |
123
|
|
|
|
|
|
|
|
124
|
45
|
|
|
|
|
151
|
for my $f (keys %$s){ |
125
|
45
|
|
|
|
|
57
|
for my $sub (keys %{$s->{$f}{subs}}){ |
|
45
|
|
|
|
|
190
|
|
126
|
423
|
|
|
|
|
302
|
my $found = 0; |
127
|
423
|
|
|
|
|
250
|
my @has; |
128
|
423
|
|
|
|
|
279
|
for (@{$s->{$f}{subs}{$sub}{code}}){ |
|
423
|
|
|
|
|
669
|
|
129
|
2178
|
100
|
100
|
|
|
6887
|
if ($_ and /$search/){ |
130
|
181
|
|
|
|
|
130
|
$found++; |
131
|
181
|
|
|
|
|
248
|
push @has, $_; |
132
|
|
|
|
|
|
|
} |
133
|
|
|
|
|
|
|
} |
134
|
423
|
100
|
|
|
|
578
|
if (! $found){ |
135
|
253
|
|
|
|
|
476
|
delete $s->{$f}{subs}{$sub}; |
136
|
253
|
|
|
|
|
314
|
next; |
137
|
|
|
|
|
|
|
} |
138
|
170
|
|
|
|
|
345
|
$s->{$f}{subs}{$sub}{code} = \@has; |
139
|
|
|
|
|
|
|
} |
140
|
|
|
|
|
|
|
} |
141
|
45
|
|
|
|
|
123
|
return $struct; |
142
|
72
|
|
|
|
|
476
|
}; |
143
|
|
|
|
|
|
|
} |
144
|
|
|
|
|
|
|
sub end_of_last_sub { |
145
|
|
|
|
|
|
|
|
146
|
6
|
100
|
|
6
|
1
|
433
|
trace() if $ENV{TRACE}; |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
return sub { |
149
|
|
|
|
|
|
|
|
150
|
4
|
50
|
|
4
|
|
10
|
trace() if $ENV{TRACE}; |
151
|
|
|
|
|
|
|
|
152
|
4
|
|
|
|
|
5
|
my $p = shift; |
153
|
4
|
|
|
|
|
6
|
my $struct = shift; |
154
|
|
|
|
|
|
|
|
155
|
4
|
|
|
|
|
5
|
my @last_line_nums; |
156
|
|
|
|
|
|
|
|
157
|
4
|
|
|
|
|
6
|
for my $sub (@$struct){ |
158
|
43
|
|
|
|
|
38
|
push @last_line_nums, $sub->{end}; |
159
|
|
|
|
|
|
|
} |
160
|
|
|
|
|
|
|
|
161
|
4
|
|
|
|
|
19
|
@last_line_nums = sort {$a<=>$b} @last_line_nums; |
|
110
|
|
|
|
|
74
|
|
162
|
|
|
|
|
|
|
|
163
|
4
|
|
|
|
|
10
|
return $last_line_nums[-1]; |
164
|
|
|
|
|
|
|
|
165
|
5
|
|
|
|
|
1131
|
}; |
166
|
|
|
|
|
|
|
} |
167
|
|
|
|
|
|
|
sub _test { |
168
|
|
|
|
|
|
|
|
169
|
4
|
100
|
|
4
|
|
744
|
trace() if $ENV{TRACE}; |
170
|
|
|
|
|
|
|
|
171
|
|
|
|
|
|
|
return sub { |
172
|
|
|
|
|
|
|
|
173
|
1
|
50
|
|
1
|
|
5
|
trace() if $ENV{TRACE}; |
174
|
1
|
|
|
|
|
2
|
my $p = shift; |
175
|
1
|
|
|
|
|
2
|
my $struct = shift; |
176
|
1
|
|
|
|
|
3
|
return $struct; |
177
|
3
|
|
|
|
|
21
|
}; |
178
|
|
|
|
|
|
|
} |
179
|
|
|
|
|
|
|
sub objects { |
180
|
|
|
|
|
|
|
|
181
|
18
|
100
|
|
18
|
0
|
770
|
trace() if $ENV{TRACE}; |
182
|
|
|
|
|
|
|
|
183
|
|
|
|
|
|
|
# uses 'subs' post_proc |
184
|
|
|
|
|
|
|
|
185
|
|
|
|
|
|
|
return sub { |
186
|
|
|
|
|
|
|
|
187
|
16
|
50
|
|
16
|
|
39
|
trace() if $ENV{TRACE}; |
188
|
|
|
|
|
|
|
|
189
|
16
|
|
|
|
|
17
|
my $p = shift; |
190
|
16
|
|
|
|
|
25
|
my $struct = shift; |
191
|
|
|
|
|
|
|
|
192
|
16
|
|
|
|
|
16
|
my @return; |
193
|
|
|
|
|
|
|
|
194
|
16
|
50
|
|
|
|
45
|
return if not ref($struct) eq 'ARRAY'; |
195
|
|
|
|
|
|
|
|
196
|
16
|
|
|
|
|
25
|
my $file = $p->{file}; |
197
|
16
|
|
|
|
|
21
|
my $search = $p->{search}; |
198
|
|
|
|
|
|
|
|
199
|
16
|
100
|
100
|
|
|
58
|
if ($search && ! $p->{regex}){ |
200
|
1
|
|
|
|
|
2
|
$search = "\Q$search"; |
201
|
|
|
|
|
|
|
} |
202
|
|
|
|
|
|
|
|
203
|
16
|
|
|
|
|
15
|
my $lines; |
204
|
|
|
|
|
|
|
|
205
|
|
|
|
|
|
|
my $des_sub; |
206
|
|
|
|
|
|
|
|
207
|
16
|
|
|
|
|
30
|
for my $sub (@$struct){ |
208
|
|
|
|
|
|
|
|
209
|
|
|
|
|
|
|
$des_sub |
210
|
91
|
|
|
|
|
214
|
= Devel::Examine::Subs::Sub->new($sub, $sub->{name}); |
211
|
|
|
|
|
|
|
|
212
|
91
|
|
|
|
|
83
|
push @return, $des_sub; |
213
|
|
|
|
|
|
|
} |
214
|
|
|
|
|
|
|
|
215
|
16
|
|
|
|
|
33
|
return \@return; |
216
|
17
|
|
|
|
|
76
|
}; |
217
|
|
|
|
|
|
|
} |
218
|
1
|
|
|
1
|
|
3
|
sub _vim_placeholder {1;} |
219
|
|
|
|
|
|
|
1; |
220
|
|
|
|
|
|
|
__END__ |