line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Perinci::Sub::Dep::pm; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
52381
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
4
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
17
|
|
5
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
26
|
|
6
|
|
|
|
|
|
|
|
7
|
1
|
|
|
1
|
|
670
|
use Perinci::Sub::DepUtil qw(declare_function_dep); |
|
1
|
|
|
|
|
395
|
|
|
1
|
|
|
|
|
161
|
|
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
our $VERSION = '0.30'; # VERSION |
10
|
|
|
|
|
|
|
|
11
|
|
|
|
|
|
|
declare_function_dep( |
12
|
|
|
|
|
|
|
name => 'pm', |
13
|
|
|
|
|
|
|
schema => ['str*' => {}], |
14
|
|
|
|
|
|
|
check => sub { |
15
|
3
|
|
|
3
|
|
1264
|
my ($val) = @_; |
16
|
3
|
|
|
|
|
5
|
my $m = $val; |
17
|
3
|
|
|
|
|
6
|
my $wv; # wanted version |
18
|
3
|
100
|
|
|
|
22
|
$m =~ s/\s*(?:>=)\s*([0-9]\S*)$// and $wv = $1; |
19
|
3
|
|
|
|
|
7
|
$m =~ s!::!/!g; |
20
|
3
|
|
|
|
|
4
|
$m .= ".pm"; |
21
|
3
|
|
|
|
|
6
|
eval { require $m }; |
|
3
|
|
|
|
|
1821
|
|
22
|
3
|
|
|
|
|
19
|
my $e = $@; |
23
|
3
|
100
|
|
|
|
12
|
return "Can't load module $val" if $e; |
24
|
1
|
|
|
1
|
|
5
|
no strict 'refs'; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
126
|
|
25
|
2
|
100
|
|
|
|
10
|
if (defined $wv) { |
26
|
1
|
|
|
|
|
957
|
require Sort::Versions; |
27
|
1
|
|
|
|
|
1896
|
my $mv = ${"$m\::VERSION"}; |
|
1
|
|
|
|
|
8
|
|
28
|
1
|
50
|
|
|
|
15
|
defined($mv) or return "Can't get version from $m"; |
29
|
0
|
0
|
|
|
|
0
|
return "Version of $m too old ($mv, wanted $wv)" |
30
|
|
|
|
|
|
|
if Sort::Versions::versioncmp($wv, $mv) < 0; |
31
|
|
|
|
|
|
|
} |
32
|
1
|
|
|
|
|
6
|
""; |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
); |
35
|
|
|
|
|
|
|
|
36
|
|
|
|
|
|
|
1; |
37
|
|
|
|
|
|
|
# ABSTRACT: Depend on a Perl module |
38
|
|
|
|
|
|
|
|
39
|
|
|
|
|
|
|
__END__ |