line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Test::MinimumVersion::Fast; |
2
|
2
|
|
|
2
|
|
352636
|
use 5.008005; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
80
|
|
3
|
2
|
|
|
2
|
|
11
|
use strict; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
60
|
|
4
|
2
|
|
|
2
|
|
12
|
use warnings; |
|
2
|
|
|
|
|
11
|
|
|
2
|
|
|
|
|
65
|
|
5
|
2
|
|
|
2
|
|
921
|
use parent 'Exporter'; |
|
2
|
|
|
|
|
264
|
|
|
2
|
|
|
|
|
15
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = "0.04"; |
8
|
|
|
|
|
|
|
|
9
|
2
|
|
|
2
|
|
8661
|
use File::Find::Rule; |
|
2
|
|
|
|
|
19768
|
|
|
2
|
|
|
|
|
21
|
|
10
|
2
|
|
|
2
|
|
2333
|
use File::Find::Rule::Perl; |
|
2
|
|
|
|
|
20768
|
|
|
2
|
|
|
|
|
30
|
|
11
|
2
|
|
|
2
|
|
2715
|
use Perl::MinimumVersion::Fast 0.03; |
|
2
|
|
|
|
|
38376
|
|
|
2
|
|
|
|
|
94
|
|
12
|
2
|
|
|
2
|
|
3723
|
use YAML::Tiny 1.40; # bug fixes |
|
2
|
|
|
|
|
23464
|
|
|
2
|
|
|
|
|
149
|
|
13
|
2
|
|
|
2
|
|
21
|
use version 0.70; |
|
2
|
|
|
|
|
33
|
|
|
2
|
|
|
|
|
17
|
|
14
|
|
|
|
|
|
|
|
15
|
2
|
|
|
2
|
|
142
|
use Test::Builder; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
1444
|
|
16
|
|
|
|
|
|
|
our @EXPORT = qw( |
17
|
|
|
|
|
|
|
minimum_version_ok |
18
|
|
|
|
|
|
|
all_minimum_version_ok |
19
|
|
|
|
|
|
|
all_minimum_version_from_metayml_ok |
20
|
|
|
|
|
|
|
); |
21
|
|
|
|
|
|
|
|
22
|
|
|
|
|
|
|
sub import { |
23
|
2
|
|
|
2
|
|
24
|
my($self) = shift; |
24
|
2
|
|
|
|
|
4
|
my $pack = caller; |
25
|
|
|
|
|
|
|
|
26
|
2
|
|
|
|
|
17
|
my $Test = Test::Builder->new; |
27
|
|
|
|
|
|
|
|
28
|
2
|
|
|
|
|
27
|
$Test->exported_to($pack); |
29
|
2
|
|
|
|
|
57
|
$Test->plan(@_); |
30
|
|
|
|
|
|
|
|
31
|
2
|
|
|
|
|
2922
|
$self->export_to_level(1, $self, @EXPORT); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
sub _objectify_version { |
35
|
2
|
|
|
2
|
|
73
|
my ($version) = @_; |
36
|
2
|
50
|
|
|
|
4
|
$version = eval { $version->isa('version') } |
|
2
|
|
|
|
|
33
|
|
37
|
|
|
|
|
|
|
? $version |
38
|
|
|
|
|
|
|
: version->new($version); |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
|
42
|
|
|
|
|
|
|
sub minimum_version_ok { |
43
|
2
|
|
|
2
|
0
|
1789
|
my ($file, $version) = @_; |
44
|
|
|
|
|
|
|
|
45
|
2
|
|
|
|
|
9
|
my $Test = Test::Builder->new; |
46
|
|
|
|
|
|
|
|
47
|
2
|
|
|
|
|
12
|
$version = _objectify_version($version); |
48
|
|
|
|
|
|
|
|
49
|
2
|
|
|
|
|
20
|
my $pmv = Perl::MinimumVersion::Fast->new($file); |
50
|
|
|
|
|
|
|
|
51
|
2
|
|
50
|
|
|
5405
|
my $explicit_minimum = $pmv->minimum_version || 0; |
52
|
2
|
|
50
|
|
|
1070
|
my $minimum = $pmv->minimum_syntax_version($explicit_minimum) || 0; |
53
|
|
|
|
|
|
|
|
54
|
2
|
50
|
33
|
|
|
261
|
my $is_syntax = 1 |
55
|
|
|
|
|
|
|
if $minimum and $minimum > $explicit_minimum; |
56
|
|
|
|
|
|
|
|
57
|
2
|
50
|
33
|
|
|
33
|
$minimum = $explicit_minimum |
58
|
|
|
|
|
|
|
if $explicit_minimum and $explicit_minimum > $minimum; |
59
|
|
|
|
|
|
|
|
60
|
2
|
|
|
|
|
14
|
my %min = $pmv->version_markers; |
61
|
|
|
|
|
|
|
|
62
|
2
|
50
|
|
|
|
63
|
if ($minimum <= $version) { |
63
|
2
|
|
|
|
|
18
|
$Test->ok(1, $file); |
64
|
|
|
|
|
|
|
} else { |
65
|
0
|
|
|
|
|
|
$Test->ok(0, $file); |
66
|
0
|
0
|
|
|
|
|
$Test->diag( |
67
|
|
|
|
|
|
|
"$file requires $minimum " |
68
|
|
|
|
|
|
|
. ($is_syntax ? 'due to syntax' : 'due to explicit requirement') |
69
|
|
|
|
|
|
|
); |
70
|
|
|
|
|
|
|
|
71
|
0
|
0
|
0
|
|
|
|
if ($is_syntax and my $markers = $min{ $minimum }) { |
72
|
0
|
|
|
|
|
|
$Test->diag("version markers for $minimum:"); |
73
|
0
|
|
|
|
|
|
$Test->diag("- $_ ") for @$markers; |
74
|
|
|
|
|
|
|
} |
75
|
|
|
|
|
|
|
} |
76
|
|
|
|
|
|
|
} |
77
|
|
|
|
|
|
|
|
78
|
|
|
|
|
|
|
|
79
|
|
|
|
|
|
|
sub all_minimum_version_ok { |
80
|
0
|
|
|
0
|
0
|
|
my ($version, $arg) = @_; |
81
|
0
|
|
0
|
|
|
|
$arg ||= {}; |
82
|
0
|
|
0
|
|
|
|
$arg->{paths} ||= [ qw(lib t xt/smoke), glob ("*.pm"), glob ("*.PL") ]; |
83
|
|
|
|
|
|
|
|
84
|
0
|
|
|
|
|
|
my $Test = Test::Builder->new; |
85
|
|
|
|
|
|
|
|
86
|
0
|
|
|
|
|
|
$version = _objectify_version($version); |
87
|
|
|
|
|
|
|
|
88
|
0
|
|
|
|
|
|
my @perl_files; |
89
|
0
|
|
|
|
|
|
for my $path (@{ $arg->{paths} }) { |
|
0
|
|
|
|
|
|
|
90
|
0
|
0
|
0
|
|
|
|
if (-f $path and -s $path) { |
|
|
0
|
|
|
|
|
|
91
|
0
|
|
|
|
|
|
push @perl_files, $path; |
92
|
|
|
|
|
|
|
} elsif (-d $path) { |
93
|
0
|
|
|
|
|
|
push @perl_files, File::Find::Rule->perl_file->in($path); |
94
|
|
|
|
|
|
|
} |
95
|
|
|
|
|
|
|
} |
96
|
|
|
|
|
|
|
|
97
|
0
|
0
|
0
|
|
|
|
unless ($Test->has_plan or $arg->{no_plan}) { |
98
|
0
|
|
|
|
|
|
$Test->plan(tests => scalar @perl_files); |
99
|
|
|
|
|
|
|
} |
100
|
|
|
|
|
|
|
|
101
|
0
|
|
|
|
|
|
minimum_version_ok($_, $version) for @perl_files; |
102
|
|
|
|
|
|
|
} |
103
|
|
|
|
|
|
|
|
104
|
|
|
|
|
|
|
|
105
|
|
|
|
|
|
|
sub all_minimum_version_from_metayml_ok { |
106
|
0
|
|
|
0
|
0
|
|
my ($arg) = @_; |
107
|
0
|
|
0
|
|
|
|
$arg ||= {}; |
108
|
|
|
|
|
|
|
|
109
|
0
|
|
|
|
|
|
my $Test = Test::Builder->new; |
110
|
|
|
|
|
|
|
|
111
|
0
|
0
|
0
|
|
|
|
$Test->plan(skip_all => "META.yml could not be found") |
112
|
|
|
|
|
|
|
unless -f 'META.yml' and -r _; |
113
|
|
|
|
|
|
|
|
114
|
0
|
|
|
|
|
|
my $documents = YAML::Tiny->read('META.yml'); |
115
|
|
|
|
|
|
|
|
116
|
0
|
0
|
|
|
|
|
$Test->plan(skip_all => "no minimum perl version could be determined") |
117
|
|
|
|
|
|
|
unless my $version = $documents->[0]->{requires}{perl}; |
118
|
|
|
|
|
|
|
|
119
|
0
|
|
|
|
|
|
all_minimum_version_ok($version, $arg); |
120
|
|
|
|
|
|
|
} |
121
|
|
|
|
|
|
|
|
122
|
|
|
|
|
|
|
1; |
123
|
|
|
|
|
|
|
__END__ |
124
|
|
|
|
|
|
|
|
125
|
|
|
|
|
|
|
=encoding utf-8 |
126
|
|
|
|
|
|
|
|
127
|
|
|
|
|
|
|
=head1 NAME |
128
|
|
|
|
|
|
|
|
129
|
|
|
|
|
|
|
Test::MinimumVersion::Fast - does your code require newer perl than you think? |
130
|
|
|
|
|
|
|
|
131
|
|
|
|
|
|
|
=head1 SYNOPSIS |
132
|
|
|
|
|
|
|
|
133
|
|
|
|
|
|
|
#!perl |
134
|
|
|
|
|
|
|
use Test::MinimumVersion; |
135
|
|
|
|
|
|
|
all_minimum_version_from_metayml_ok(); |
136
|
|
|
|
|
|
|
|
137
|
|
|
|
|
|
|
=head1 DESCRIPTION |
138
|
|
|
|
|
|
|
|
139
|
|
|
|
|
|
|
Test::MinimumVersion::Fast is a faster implementation of L<Test::MinimumVersion> using L<Perl::MinimumVersion::Fast>. |
140
|
|
|
|
|
|
|
|
141
|
|
|
|
|
|
|
=head1 LICENSE |
142
|
|
|
|
|
|
|
|
143
|
|
|
|
|
|
|
Copyright (C) tokuhirom. |
144
|
|
|
|
|
|
|
|
145
|
|
|
|
|
|
|
This library is free software; you can redistribute it and/or modify |
146
|
|
|
|
|
|
|
it under the same terms as Perl itself. |
147
|
|
|
|
|
|
|
|
148
|
|
|
|
|
|
|
=head1 AUTHOR |
149
|
|
|
|
|
|
|
|
150
|
|
|
|
|
|
|
tokuhirom E<lt>tokuhirom@gmail.comE<gt> |
151
|
|
|
|
|
|
|
|
152
|
|
|
|
|
|
|
=cut |
153
|
|
|
|
|
|
|
|