line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Audit::Installed; |
2
|
3
|
|
|
3
|
|
66124
|
use strict; |
|
3
|
|
|
|
|
19
|
|
|
3
|
|
|
|
|
116
|
|
3
|
3
|
|
|
3
|
|
19
|
use warnings; |
|
3
|
|
|
|
|
6
|
|
|
3
|
|
|
|
|
98
|
|
4
|
3
|
|
|
3
|
|
17
|
use File::Find (); |
|
3
|
|
|
|
|
7
|
|
|
3
|
|
|
|
|
38
|
|
5
|
3
|
|
|
3
|
|
17
|
use Cwd (); |
|
3
|
|
|
|
|
42
|
|
|
3
|
|
|
|
|
1993
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "1.001"; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub new { |
10
|
1
|
|
|
1
|
0
|
1190
|
my( $class, %params ) = @_; |
11
|
1
|
|
|
|
|
5
|
bless \%params, $class; |
12
|
|
|
|
|
|
|
} |
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub find { |
15
|
1
|
|
|
1
|
0
|
3
|
my $self = shift; |
16
|
1
|
|
|
|
|
12
|
my (@inc) = @_; |
17
|
|
|
|
|
|
|
|
18
|
1
|
50
|
|
|
|
4
|
@inc = @INC unless @inc; |
19
|
1
|
50
|
|
|
|
4
|
@inc = grep { defined && -d $_ } map { Cwd::realpath($_) } @inc; |
|
1
|
|
|
|
|
21
|
|
|
1
|
|
|
|
|
44
|
|
20
|
|
|
|
|
|
|
|
21
|
1
|
|
|
|
|
5
|
my %seen; |
22
|
|
|
|
|
|
|
my @deps; |
23
|
1
|
50
|
|
|
|
6
|
push @deps, { dist => 'perl', version => $] } if $self->{include_perl}; |
24
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
File::Find::find( |
26
|
|
|
|
|
|
|
{ |
27
|
|
|
|
|
|
|
wanted => sub { |
28
|
5
|
|
|
5
|
|
18
|
my $path = $File::Find::name; |
29
|
5
|
100
|
66
|
|
|
552
|
if ( $path && -f $path && m/\.pm$/ ) { |
|
|
|
66
|
|
|
|
|
30
|
1
|
50
|
|
|
|
4
|
return unless my $module = module_from_file($path); |
31
|
|
|
|
|
|
|
|
32
|
1
|
50
|
|
|
|
18
|
return unless my $distname = $self->{db}->{module2dist}->{$module}; |
33
|
|
|
|
|
|
|
|
34
|
1
|
|
|
|
|
3
|
my $dist = $self->{db}->{dists}->{$distname}; |
35
|
1
|
50
|
|
|
|
4
|
if ( $dist->{main_module} eq $module ) { |
36
|
1
|
50
|
|
|
|
5
|
return if $seen{$module}++; |
37
|
|
|
|
|
|
|
|
38
|
1
|
50
|
|
|
|
3
|
return unless my $version = module_version($path); |
39
|
|
|
|
|
|
|
|
40
|
1
|
|
|
|
|
5
|
push @deps, { dist => $distname, version => $version }; |
41
|
|
|
|
|
|
|
|
42
|
1
|
50
|
|
|
|
55
|
if ( $self->{cb} ) { |
43
|
0
|
|
|
|
|
0
|
$self->{cb}->( |
44
|
|
|
|
|
|
|
{ |
45
|
|
|
|
|
|
|
path => $path, |
46
|
|
|
|
|
|
|
distname => $distname, |
47
|
|
|
|
|
|
|
version => $version |
48
|
|
|
|
|
|
|
} |
49
|
|
|
|
|
|
|
); |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
} |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
}, |
54
|
1
|
|
|
|
|
182
|
follow => 1, |
55
|
|
|
|
|
|
|
follow_skip => 2, |
56
|
|
|
|
|
|
|
}, |
57
|
|
|
|
|
|
|
@inc |
58
|
|
|
|
|
|
|
); |
59
|
|
|
|
|
|
|
|
60
|
1
|
|
|
|
|
17
|
return @deps; |
61
|
|
|
|
|
|
|
} |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
sub module_version { |
64
|
1
|
|
|
1
|
0
|
441
|
require Module::Extract::VERSION; |
65
|
1
|
|
|
|
|
1678
|
my( $file ) = @_; |
66
|
|
|
|
|
|
|
|
67
|
1
|
|
|
|
|
10
|
my $version = Module::Extract::VERSION->parse_version_safely( $file ); |
68
|
|
|
|
|
|
|
|
69
|
1
|
50
|
|
|
|
45968
|
if( eval { $version->can('numify') } ) { |
|
1
|
|
|
|
|
11
|
|
70
|
0
|
|
|
|
|
0
|
$version = $version->numify; |
71
|
|
|
|
|
|
|
} |
72
|
|
|
|
|
|
|
|
73
|
1
|
|
|
|
|
6
|
return "$version"; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
|
76
|
|
|
|
|
|
|
sub module_from_file { |
77
|
1
|
|
|
1
|
0
|
4
|
my ($path) = @_; |
78
|
1
|
|
|
|
|
2
|
my $module; |
79
|
|
|
|
|
|
|
|
80
|
1
|
50
|
|
|
|
41
|
open my $fh, '<', $path or return; |
81
|
1
|
|
|
|
|
29
|
while ( my $line = <$fh> ) { |
82
|
9
|
100
|
|
|
|
39
|
if ( $line =~ m/package\s+(.*?)\s*;/ms ) { |
83
|
1
|
|
|
|
|
4
|
$module = $1; |
84
|
1
|
|
|
|
|
2
|
last; |
85
|
|
|
|
|
|
|
} |
86
|
|
|
|
|
|
|
} |
87
|
1
|
|
|
|
|
14
|
close $fh; |
88
|
|
|
|
|
|
|
|
89
|
1
|
50
|
|
|
|
14
|
return unless $module; |
90
|
|
|
|
|
|
|
} |
91
|
|
|
|
|
|
|
|
92
|
|
|
|
|
|
|
1; |