line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
1
|
|
|
1
|
|
948
|
use strict; use warnings; |
|
1
|
|
|
1
|
|
2
|
|
|
1
|
|
|
|
|
30
|
|
|
1
|
|
|
|
|
5
|
|
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
53
|
|
2
|
|
|
|
|
|
|
package Module::Install::RequiresList; |
3
|
|
|
|
|
|
|
our $VERSION = '0.15'; |
4
|
|
|
|
|
|
|
|
5
|
1
|
|
|
1
|
|
5
|
use base 'Module::Install::Base'; |
|
1
|
|
|
|
|
8
|
|
|
1
|
|
|
|
|
736
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $AUTHOR_ONLY = 1; |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub requires_list { |
10
|
0
|
|
|
0
|
0
|
|
my ($self) = @_; |
11
|
0
|
0
|
|
|
|
|
return $self unless $self->is_admin; |
12
|
0
|
0
|
|
|
|
|
eval "use IO::All; 1" or die $@; |
13
|
0
|
|
|
|
|
|
my $pkg = __PACKAGE__; |
14
|
0
|
|
|
|
|
|
io('Makefile')->append(<<"..."); |
15
|
|
|
|
|
|
|
|
16
|
|
|
|
|
|
|
requires-list :: |
17
|
|
|
|
|
|
|
\t\$(PERL) "-Ilib" "-M$pkg" -e "print '$pkg'->_requires_report()" |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
... |
20
|
|
|
|
|
|
|
|
21
|
0
|
|
|
|
|
|
return $self; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub _requires_report { |
25
|
0
|
|
|
0
|
|
|
require CPAN::Meta::YAML; |
26
|
0
|
|
|
|
|
|
my ($self) = @_; |
27
|
0
|
|
|
|
|
|
my $data = $self->_requires_data; |
28
|
0
|
|
|
|
|
|
return CPAN::Meta::YAML::Dump($data); |
29
|
|
|
|
|
|
|
# my $template = $self->_fetch_template; |
30
|
|
|
|
|
|
|
# tt->render(\$template, $data); |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
sub _requires_data { |
34
|
0
|
|
|
0
|
|
|
my ($self) = @_; |
35
|
0
|
|
|
|
|
|
my $data = { |
36
|
|
|
|
|
|
|
requires => {}, |
37
|
|
|
|
|
|
|
# recommends => {}, |
38
|
|
|
|
|
|
|
# build => {}, |
39
|
|
|
|
|
|
|
# author => {}, |
40
|
|
|
|
|
|
|
}; |
41
|
0
|
|
|
|
|
|
my $meta = CPAN::Meta::YAML::LoadFile('META.yml'); |
42
|
0
|
|
|
|
|
|
my $requires = $data->{requires} = $meta->{requires}; |
43
|
0
|
|
|
|
|
|
delete $requires->{perl}; |
44
|
0
|
|
|
|
|
|
for my $module (sort keys %$requires) { |
45
|
0
|
|
|
|
|
|
my $list = $requires->{$module} = [ $requires->{$module} ]; |
46
|
0
|
|
0
|
|
|
|
push @$list, eval "require $module; $module->VERSION" || 'unknown'; |
47
|
0
|
|
|
|
|
|
push @$list, $self->_cpan_version($module); |
48
|
|
|
|
|
|
|
} |
49
|
0
|
|
|
|
|
|
return $data; |
50
|
|
|
|
|
|
|
} |
51
|
|
|
|
|
|
|
|
52
|
|
|
|
|
|
|
sub _cpan_version { |
53
|
0
|
|
|
0
|
|
|
my ($self, $module) = @_; |
54
|
0
|
|
|
|
|
|
my $str = `cpanm --info $module`; |
55
|
0
|
0
|
|
|
|
|
$str =~ /.*-(v?\d[\d\.]*)\./ |
56
|
|
|
|
|
|
|
or die "Can't get version from '$str'"; |
57
|
0
|
|
|
|
|
|
return $1; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
1; |