line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package version::Store; |
2
|
|
|
|
|
|
|
|
3
|
1
|
|
|
1
|
|
2468
|
use 5.010001; |
|
1
|
|
|
|
|
4
|
|
|
1
|
|
|
|
|
93
|
|
4
|
1
|
|
|
1
|
|
6
|
use strict 'vars'; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
37
|
|
5
|
1
|
|
|
1
|
|
6
|
use warnings; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
327
|
|
6
|
|
|
|
|
|
|
|
7
|
|
|
|
|
|
|
our $VERSION = '0.01'; # VERSION |
8
|
|
|
|
|
|
|
|
9
|
|
|
|
|
|
|
sub import { |
10
|
1
|
|
|
1
|
|
6
|
my $pkg = shift; |
11
|
1
|
|
|
|
|
4
|
my $caller = caller; |
12
|
1
|
|
|
|
|
5
|
*{"$caller\::VERSION"} = \&VERSION; |
|
1
|
|
|
|
|
38
|
|
13
|
|
|
|
|
|
|
} |
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
sub VERSION { |
16
|
2
|
|
|
2
|
0
|
15016
|
require version; |
17
|
|
|
|
|
|
|
|
18
|
2
|
|
|
|
|
5663
|
my ($pkg, $ver) = @_; |
19
|
2
|
|
|
|
|
7
|
my $caller = caller; |
20
|
2
|
|
|
|
|
3
|
my $pkg_ver = ${"$pkg\::VERSION"}; |
|
2
|
|
|
|
|
8
|
|
21
|
2
|
50
|
|
|
|
280
|
if (!defined $pkg_ver) { |
|
|
50
|
|
|
|
|
|
22
|
0
|
|
|
|
|
0
|
die "$pkg does not define \$VERSION, $caller wants >= $ver"; |
23
|
|
|
|
|
|
|
} elsif (version->parse($pkg_ver) < version->parse($ver)) { |
24
|
0
|
|
|
|
|
0
|
die "$pkg's VERSION is only $pkg_ver, caller wants >= $ver"; |
25
|
|
|
|
|
|
|
} |
26
|
2
|
|
|
|
|
9
|
${"$pkg\::USER_PACKAGES"}{$caller}{version} = $ver; |
|
2
|
|
|
|
|
49
|
|
27
|
|
|
|
|
|
|
} |
28
|
|
|
|
|
|
|
|
29
|
|
|
|
|
|
|
1; |
30
|
|
|
|
|
|
|
# ABSTRACT: Get your module's minimum/required version from your users |
31
|
|
|
|
|
|
|
|
32
|
|
|
|
|
|
|
__END__ |