line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::LatestPrereqs;
|
2
|
|
|
|
|
|
|
|
3
|
5
|
|
|
5
|
|
125548
|
use strict;
|
|
5
|
|
|
|
|
11
|
|
|
5
|
|
|
|
|
193
|
|
4
|
5
|
|
|
5
|
|
25
|
use warnings;
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
134
|
|
5
|
5
|
|
|
5
|
|
1295
|
use Test::More;
|
|
5
|
|
|
|
|
23597
|
|
|
5
|
|
|
|
|
32
|
|
6
|
5
|
|
|
5
|
|
6762
|
use CPAN::Version;
|
|
5
|
|
|
|
|
10799
|
|
|
5
|
|
|
|
|
161
|
|
7
|
5
|
|
|
5
|
|
3082
|
use Test::LatestPrereqs::Config;
|
|
5
|
|
|
|
|
47
|
|
|
5
|
|
|
|
|
129
|
|
8
|
5
|
|
|
5
|
|
27
|
use base 'Exporter';
|
|
5
|
|
|
|
|
10
|
|
|
5
|
|
|
|
|
2984
|
|
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
our $VERSION = '0.02';
|
11
|
|
|
|
|
|
|
|
12
|
|
|
|
|
|
|
our @EXPORT = qw(all_prereqs_are_latest);
|
13
|
|
|
|
|
|
|
|
14
|
|
|
|
|
|
|
sub all_prereqs_are_latest {
|
15
|
3
|
|
|
3
|
1
|
247
|
my @files = @_;
|
16
|
3
|
100
|
|
|
|
12
|
unless (@files) {
|
17
|
1
|
50
|
|
|
|
25
|
push @files, 'Makefile.PL' if -f 'Makefile.PL';
|
18
|
1
|
50
|
|
|
|
12
|
push @files, 'Build.PL' if -f 'Build.PL';
|
19
|
|
|
|
|
|
|
}
|
20
|
|
|
|
|
|
|
|
21
|
3
|
|
|
|
|
6
|
my @requires;
|
22
|
3
|
|
|
|
|
11
|
foreach my $file (@files) {
|
23
|
3
|
50
|
|
|
|
89
|
next unless -f $file;
|
24
|
3
|
50
|
|
|
|
144
|
open my $fh, '<', $file or next;
|
25
|
3
|
|
|
|
|
6
|
my $content = do { local $/; <$fh> };
|
|
3
|
|
|
|
|
13
|
|
|
3
|
|
|
|
|
138
|
|
26
|
3
|
100
|
|
|
|
33
|
if ($file =~ /Makefile\.PL$/) {
|
|
|
50
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
17
|
if ($content =~ /WriteMakefile\s*\(/) {
|
|
|
0
|
|
|
|
|
|
28
|
2
|
|
|
|
|
1518
|
require Test::LatestPrereqs::MakeMaker;
|
29
|
2
|
|
|
|
|
19
|
push @requires, Test::LatestPrereqs::MakeMaker->parse($file);
|
30
|
|
|
|
|
|
|
}
|
31
|
|
|
|
|
|
|
elsif ($content =~ /use\s+inc::Module::Install/) {
|
32
|
0
|
|
|
|
|
0
|
require Test::LatestPrereqs::ModuleInstall;
|
33
|
0
|
|
|
|
|
0
|
push @requires, Test::LatestPrereqs::ModuleInstall->parse($file);
|
34
|
|
|
|
|
|
|
}
|
35
|
|
|
|
|
|
|
}
|
36
|
|
|
|
|
|
|
elsif ($file =~ /Build\.PL$/) {
|
37
|
1
|
|
|
|
|
568
|
require Test::LatestPrereqs::ModuleBuild;
|
38
|
1
|
|
|
|
|
8
|
push @requires, Test::LatestPrereqs::ModuleBuild->parse($file);
|
39
|
|
|
|
|
|
|
}
|
40
|
|
|
|
|
|
|
}
|
41
|
|
|
|
|
|
|
|
42
|
3
|
100
|
|
|
|
35
|
if (!Test::More->builder->{Have_Plan}) {
|
43
|
1
|
50
|
|
|
|
26
|
unless (@requires) {
|
44
|
0
|
|
|
|
|
0
|
plan skip_all => 'no prereqs';
|
45
|
0
|
|
|
|
|
0
|
return;
|
46
|
|
|
|
|
|
|
}
|
47
|
1
|
|
|
|
|
9
|
plan tests => scalar @requires;
|
48
|
|
|
|
|
|
|
}
|
49
|
|
|
|
|
|
|
|
50
|
3
|
|
|
|
|
1023
|
my $required = Test::LatestPrereqs::Config->load;
|
51
|
|
|
|
|
|
|
|
52
|
3
|
|
|
|
|
10
|
foreach my $require (@requires) {
|
53
|
12
|
|
|
|
|
2679
|
my ($module, $version) = @{ $require };
|
|
12
|
|
|
|
|
28
|
|
54
|
12
|
100
|
66
|
|
|
76
|
if ($required->{$module} && (!$version or CPAN::Version->vgt($required->{$module}, $version))) {
|
|
|
|
66
|
|
|
|
|
55
|
2
|
|
|
|
|
115
|
fail("$module requires at least $$required{$module} (current: $version)");
|
56
|
|
|
|
|
|
|
}
|
57
|
|
|
|
|
|
|
else {
|
58
|
10
|
|
|
|
|
62
|
pass("$module $version is ok");
|
59
|
|
|
|
|
|
|
}
|
60
|
|
|
|
|
|
|
}
|
61
|
3
|
|
|
|
|
672
|
return @requires;
|
62
|
|
|
|
|
|
|
}
|
63
|
|
|
|
|
|
|
|
64
|
|
|
|
|
|
|
1;
|
65
|
|
|
|
|
|
|
|
66
|
|
|
|
|
|
|
__END__
|