line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::LocalFunctions::Util; |
2
|
|
|
|
|
|
|
|
3
|
48
|
|
|
48
|
|
252
|
use strict; |
|
48
|
|
|
|
|
96
|
|
|
48
|
|
|
|
|
1495
|
|
4
|
48
|
|
|
48
|
|
242
|
use warnings; |
|
48
|
|
|
|
|
79
|
|
|
48
|
|
|
|
|
1223
|
|
5
|
48
|
|
|
48
|
|
41252
|
use Sub::Identify qw/stash_name/; |
|
48
|
|
|
|
|
58613
|
|
|
48
|
|
|
|
|
3137
|
|
6
|
48
|
|
|
48
|
|
29320
|
use Module::Load; |
|
48
|
|
|
|
|
33969
|
|
|
48
|
|
|
|
|
322
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
sub list_local_functions { |
9
|
30
|
|
|
30
|
0
|
231
|
my $module = shift; |
10
|
|
|
|
|
|
|
|
11
|
30
|
|
|
|
|
406
|
my @local_functions; |
12
|
|
|
|
|
|
|
|
13
|
48
|
|
|
48
|
|
3114
|
no strict 'refs'; |
|
48
|
|
|
|
|
84
|
|
|
48
|
|
|
|
|
6069
|
|
14
|
30
|
|
|
|
|
1282
|
load $module; |
15
|
30
|
|
|
|
|
18129
|
my %package = %{"${module}::"}; |
|
30
|
|
|
|
|
5244
|
|
16
|
30
|
|
|
|
|
660
|
while ( my ( $key, $value ) = each %package ) { |
17
|
223
|
100
|
|
|
|
2083
|
next unless $key =~ /^_/; |
18
|
62
|
100
|
|
|
|
146
|
next unless *{"${module}::${key}"}{CODE}; |
|
62
|
|
|
|
|
2627
|
|
19
|
56
|
50
|
|
|
|
2615
|
next unless $module eq stash_name( $module->can($key) ); |
20
|
56
|
|
|
|
|
1321
|
push @local_functions, $key; |
21
|
|
|
|
|
|
|
} |
22
|
48
|
|
|
48
|
|
225
|
use strict 'refs'; |
|
48
|
|
|
|
|
93
|
|
|
48
|
|
|
|
|
9609
|
|
23
|
|
|
|
|
|
|
|
24
|
30
|
|
|
|
|
464
|
return @local_functions; |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub extract_module_name { |
28
|
30
|
|
|
30
|
0
|
854
|
my $file = shift; |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
# e.g. |
31
|
|
|
|
|
|
|
# If file name is `lib/Foo/Bar.pm` then module name will be `Foo::Bar` |
32
|
30
|
50
|
|
|
|
3329
|
if ( $file =~ /\.pm/ ) { |
33
|
30
|
|
|
|
|
1070
|
my $module = $file; |
34
|
30
|
|
|
|
|
4850
|
$module =~ s!\A.*\blib/!!; |
35
|
30
|
|
|
|
|
615
|
$module =~ s!\.pm\Z!!; |
36
|
30
|
|
|
|
|
630
|
$module =~ s!/!::!g; |
37
|
30
|
|
|
|
|
830
|
return $module; |
38
|
|
|
|
|
|
|
} |
39
|
|
|
|
|
|
|
|
40
|
0
|
|
|
|
|
|
return $file; |
41
|
|
|
|
|
|
|
} |
42
|
|
|
|
|
|
|
1; |