| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
1
|
|
|
1
|
|
783
|
use strict; |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
43
|
|
|
2
|
|
|
|
|
|
|
package Module::Depends; |
|
3
|
1
|
|
|
1
|
|
993
|
use Parse::CPAN::Meta; |
|
|
1
|
|
|
|
|
1319
|
|
|
|
1
|
|
|
|
|
51
|
|
|
4
|
1
|
|
|
1
|
|
17
|
use Cwd qw( getcwd ); |
|
|
1
|
|
|
|
|
1
|
|
|
|
1
|
|
|
|
|
45
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base qw( Class::Accessor::Chained ); |
|
|
1
|
|
|
|
|
2
|
|
|
|
1
|
|
|
|
|
912
|
|
|
6
|
|
|
|
|
|
|
__PACKAGE__->mk_accessors(qw( dist_dir debug libs requires configure_requires build_requires error )); |
|
7
|
|
|
|
|
|
|
our $VERSION = '0.16'; |
|
8
|
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
=head1 NAME |
|
10
|
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
Module::Depends - identify the dependencies of a distribution |
|
12
|
|
|
|
|
|
|
|
|
13
|
|
|
|
|
|
|
=head1 SYNOPSIS |
|
14
|
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
use YAML; |
|
16
|
|
|
|
|
|
|
use Module::Depends; |
|
17
|
|
|
|
|
|
|
my $deps = Module::Depends->new->dist_dir( '.' )->find_modules; |
|
18
|
|
|
|
|
|
|
print "Our dependencies:\n", Dump $deps->requires; |
|
19
|
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
=head1 DESCRIPTION |
|
21
|
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
Module::Depends extracts module dependencies from an unpacked |
|
23
|
|
|
|
|
|
|
distribution tree. |
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
Module::Depends only evaluates the META.yml shipped with a |
|
26
|
|
|
|
|
|
|
distribution. This won't be effective until all distributions ship |
|
27
|
|
|
|
|
|
|
META.yml files, so we suggest you take your life in your hands and |
|
28
|
|
|
|
|
|
|
look at Module::Depends::Intrusive. |
|
29
|
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
=head1 METHODS |
|
31
|
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
=head2 new |
|
33
|
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
simple constructor |
|
35
|
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
=cut |
|
37
|
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub new { |
|
39
|
12
|
|
|
12
|
1
|
9506
|
my $self = shift; |
|
40
|
|
|
|
|
|
|
|
|
41
|
12
|
|
|
|
|
126
|
return $self->SUPER::new({ |
|
42
|
|
|
|
|
|
|
libs => [], |
|
43
|
|
|
|
|
|
|
requires => {}, |
|
44
|
|
|
|
|
|
|
build_requires => {}, |
|
45
|
|
|
|
|
|
|
configure_requires => {}, |
|
46
|
|
|
|
|
|
|
error => '', |
|
47
|
|
|
|
|
|
|
}); |
|
48
|
|
|
|
|
|
|
} |
|
49
|
|
|
|
|
|
|
|
|
50
|
|
|
|
|
|
|
=head2 dist_dir |
|
51
|
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
Path where the distribution has been extracted to. |
|
53
|
|
|
|
|
|
|
|
|
54
|
|
|
|
|
|
|
=head2 find_modules |
|
55
|
|
|
|
|
|
|
|
|
56
|
|
|
|
|
|
|
scan the C to populate C, C, and C |
|
57
|
|
|
|
|
|
|
|
|
58
|
|
|
|
|
|
|
=cut |
|
59
|
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
sub find_modules { |
|
61
|
13
|
|
|
13
|
1
|
943
|
my $self = shift; |
|
62
|
|
|
|
|
|
|
|
|
63
|
13
|
|
|
|
|
75
|
my $here = getcwd; |
|
64
|
13
|
100
|
|
|
|
64
|
unless (chdir $self->dist_dir) { |
|
65
|
1
|
|
|
|
|
24
|
$self->error( "couldn't chdir to " . $self->dist_dir . ": $!" ); |
|
66
|
1
|
|
|
|
|
39
|
return $self; |
|
67
|
|
|
|
|
|
|
} |
|
68
|
12
|
|
|
|
|
297
|
eval { $self->_find_modules }; |
|
|
12
|
|
|
|
|
41
|
|
|
69
|
12
|
|
|
|
|
261
|
chdir $here; |
|
70
|
12
|
50
|
|
|
|
34
|
die $@ if $@; |
|
71
|
|
|
|
|
|
|
|
|
72
|
12
|
|
|
|
|
34
|
return $self; |
|
73
|
|
|
|
|
|
|
} |
|
74
|
|
|
|
|
|
|
|
|
75
|
|
|
|
|
|
|
sub _find_modules { |
|
76
|
2
|
|
|
2
|
|
3
|
my $self = shift; |
|
77
|
|
|
|
|
|
|
|
|
78
|
2
|
|
|
|
|
5
|
my ($file) = grep { -e $_ } qw( MYMETA.yml META.yml ); |
|
|
4
|
|
|
|
|
46
|
|
|
79
|
2
|
50
|
|
|
|
6
|
if ($file) { |
|
80
|
2
|
|
|
|
|
10
|
my $meta = ( Parse::CPAN::Meta::LoadFile( $file ) )[0]; |
|
81
|
2
|
|
|
|
|
31281
|
$self->requires( $meta->{requires} ); |
|
82
|
2
|
|
|
|
|
34
|
$self->build_requires( $meta->{build_requires} ); |
|
83
|
|
|
|
|
|
|
} |
|
84
|
|
|
|
|
|
|
else { |
|
85
|
0
|
|
|
|
|
0
|
$self->error( "No META.yml found in ". $self->dist_dir ); |
|
86
|
|
|
|
|
|
|
} |
|
87
|
2
|
|
|
|
|
30
|
return $self; |
|
88
|
|
|
|
|
|
|
} |
|
89
|
|
|
|
|
|
|
|
|
90
|
|
|
|
|
|
|
|
|
91
|
|
|
|
|
|
|
1; |
|
92
|
|
|
|
|
|
|
__END__ |