line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package CPAN::Packager::MetaAnalyzer; |
2
|
2
|
|
|
2
|
|
13
|
use Mouse; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
14
|
|
3
|
2
|
|
|
2
|
|
773
|
use Parse::CPAN::Meta (); |
|
2
|
|
|
|
|
14
|
|
|
2
|
|
|
|
|
40
|
|
4
|
2
|
|
|
2
|
|
13
|
use Try::Tiny; |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
158
|
|
5
|
2
|
|
|
2
|
|
12
|
use Log::Log4perl qw(:easy); |
|
2
|
|
|
|
|
4
|
|
|
2
|
|
|
|
|
23
|
|
6
|
2
|
|
|
2
|
|
1551
|
use CPAN::Packager::FileUtil qw(file dir); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
140
|
|
7
|
2
|
|
|
2
|
|
12
|
use CPAN::Packager::ListUtil qw(uniq any); |
|
2
|
|
|
|
|
12
|
|
|
2
|
|
|
|
|
1445
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub get_dependencies_from_meta { |
10
|
0
|
|
|
0
|
0
|
|
my ( $self, $dist_dir ) = @_; |
11
|
|
|
|
|
|
|
|
12
|
0
|
|
|
|
|
|
my ($metayml) = grep -e file( $dist_dir, $_ ), qw( MYMETA.yml META.yml ); |
13
|
0
|
0
|
|
|
|
|
if ($metayml) { |
14
|
0
|
|
|
|
|
|
$metayml = file( $dist_dir, $metayml ); |
15
|
0
|
|
|
|
|
|
return $self->get_dependencies_from_metayaml_file( $metayml, |
16
|
|
|
|
|
|
|
$dist_dir ); |
17
|
|
|
|
|
|
|
} |
18
|
|
|
|
|
|
|
else { |
19
|
0
|
|
|
|
|
|
[]; |
20
|
|
|
|
|
|
|
} |
21
|
|
|
|
|
|
|
} |
22
|
|
|
|
|
|
|
|
23
|
|
|
|
|
|
|
sub get_dependencies_from_metayaml_file { |
24
|
0
|
|
|
0
|
0
|
|
my ( $self, $metayml, $dist_dir ) = @_; |
25
|
0
|
|
|
|
|
|
my $meta = {}; |
26
|
0
|
|
|
|
|
|
my %deps; |
27
|
|
|
|
|
|
|
try { |
28
|
0
|
|
|
0
|
|
|
$meta = $self->parse_meta($metayml); |
29
|
0
|
0
|
|
|
|
|
%deps = ( %{ $meta->{requires} || {} } ); |
|
0
|
|
|
|
|
|
|
30
|
0
|
0
|
|
|
|
|
%deps = ( |
31
|
|
|
|
|
|
|
%deps, |
32
|
0
|
0
|
|
|
|
|
%{ $meta->{build_requires} || {} }, |
33
|
0
|
|
|
|
|
|
%{ $meta->{test_requires} || {} } |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
catch { |
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
# FIXME: hmm |
39
|
0
|
0
|
|
0
|
|
|
if ($dist_dir) { |
40
|
0
|
|
|
|
|
|
DEBUG( "Can't parse META.yml:" . $_ ); |
41
|
0
|
|
|
|
|
|
my $dependencies |
42
|
|
|
|
|
|
|
= Module::Depends::Intrusive->new->dist_dir($dist_dir) |
43
|
|
|
|
|
|
|
->find_modules; |
44
|
0
|
0
|
|
|
|
|
%deps = ( |
45
|
0
|
0
|
|
|
|
|
%{ $dependencies->{requires} || {} }, |
46
|
0
|
|
|
|
|
|
%{ $dependencies->{build_requires} || {} } |
47
|
|
|
|
|
|
|
); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
}; |
50
|
0
|
|
|
|
|
|
my @dependencies = uniq( keys %deps ); |
51
|
0
|
|
|
|
|
|
return \@dependencies; |
52
|
|
|
|
|
|
|
} |
53
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
sub parse_meta { |
55
|
0
|
|
|
0
|
0
|
|
my ( $self, $file ) = @_; |
56
|
0
|
|
|
|
|
|
return ( Parse::CPAN::Meta::LoadFile($file) )[0]; |
57
|
|
|
|
|
|
|
} |
58
|
|
|
|
|
|
|
|
59
|
|
|
|
|
|
|
sub parse_meta_from_content { |
60
|
0
|
|
|
0
|
0
|
|
my ($self, $file_content) = @_; |
61
|
0
|
|
|
|
|
|
return ( Parse::CPAN::Meta::Load($file_content) )[0]; |
62
|
|
|
|
|
|
|
} |
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
65
|
|
|
|
|
|
|
1; |