line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package PMVersions::Util; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $AUTHORITY = 'cpan:PERLANCAR'; # AUTHORITY |
4
|
|
|
|
|
|
|
our $DATE = '2020-11-11'; # DATE |
5
|
|
|
|
|
|
|
our $DIST = 'PMVersions-Util'; # DIST |
6
|
|
|
|
|
|
|
our $VERSION = '0.002'; # VERSION |
7
|
|
|
|
|
|
|
|
8
|
1
|
|
|
1
|
|
93197
|
use 5.010001; |
|
1
|
|
|
|
|
14
|
|
9
|
1
|
|
|
1
|
|
5
|
use strict; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
20
|
|
10
|
1
|
|
|
1
|
|
5
|
use warnings; |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
26
|
|
11
|
|
|
|
|
|
|
|
12
|
1
|
|
|
1
|
|
511
|
use Config::IOD::Reader; |
|
1
|
|
|
|
|
5429
|
|
|
1
|
|
|
|
|
36
|
|
13
|
1
|
|
|
1
|
|
499
|
use File::HomeDir; |
|
1
|
|
|
|
|
5554
|
|
|
1
|
|
|
|
|
54
|
|
14
|
|
|
|
|
|
|
|
15
|
1
|
|
|
1
|
|
7
|
use Exporter qw(import); |
|
1
|
|
|
|
|
1
|
|
|
1
|
|
|
|
|
173
|
|
16
|
|
|
|
|
|
|
our @EXPORT_OK = qw(read_pmversions version_from_pmversions); |
17
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
sub read_pmversions { |
19
|
2
|
|
|
2
|
1
|
2188
|
my ($path) = @_; |
20
|
|
|
|
|
|
|
|
21
|
2
|
|
33
|
|
|
7
|
$path //= $ENV{PMVERSIONS_PATH}; |
22
|
2
|
|
33
|
|
|
5
|
$path //= File::HomeDir->my_home . "/pmversions.ini"; |
23
|
2
|
|
|
|
|
4
|
my $hoh; |
24
|
2
|
50
|
|
|
|
35
|
if (-e $path) { |
25
|
2
|
|
|
|
|
26
|
$hoh = Config::IOD::Reader->new->read_file($path); |
26
|
|
|
|
|
|
|
} else { |
27
|
0
|
|
|
|
|
0
|
warn "pmversions file '$path' does not exist"; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
2
|
|
50
|
|
|
12576
|
$hoh->{GLOBAL} // {}; |
31
|
|
|
|
|
|
|
} |
32
|
|
|
|
|
|
|
|
33
|
|
|
|
|
|
|
my $pmversions; |
34
|
|
|
|
|
|
|
sub version_from_pmversions { |
35
|
3
|
|
|
3
|
1
|
2977
|
my ($mod, $path) = @_; |
36
|
|
|
|
|
|
|
|
37
|
3
|
|
66
|
|
|
14
|
$pmversions //= read_pmversions($path); |
38
|
3
|
|
|
|
|
15
|
$pmversions->{$mod}; |
39
|
|
|
|
|
|
|
} |
40
|
|
|
|
|
|
|
|
41
|
|
|
|
|
|
|
1; |
42
|
|
|
|
|
|
|
# ABSTRACT: Utilities related to pmversions.ini |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__END__ |