line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Version::Monotonic; |
2
|
|
|
|
|
|
|
|
3
|
|
|
|
|
|
|
our $DATE = '2016-05-20'; # DATE |
4
|
|
|
|
|
|
|
our $VERSION = '1.100'; # VERSION |
5
|
|
|
|
|
|
|
|
6
|
|
|
|
|
|
|
#IFUNBUILT |
7
|
|
|
|
|
|
|
# # use strict; |
8
|
|
|
|
|
|
|
# # use warnings; |
9
|
|
|
|
|
|
|
#END IFUNBUILT |
10
|
|
|
|
|
|
|
|
11
|
1
|
|
|
1
|
|
12475
|
use Exporter qw(import); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
153
|
|
12
|
|
|
|
|
|
|
our @EXPORT_OK = qw( |
13
|
|
|
|
|
|
|
valid_version |
14
|
|
|
|
|
|
|
inc_version |
15
|
|
|
|
|
|
|
); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
our $re = qr/\A([1-9][0-9]*)\.([1-9][0-9]*)(\.0)?\z/; |
18
|
|
|
|
|
|
|
|
19
|
|
|
|
|
|
|
sub valid_version { |
20
|
7
|
|
|
7
|
1
|
465
|
my $v = shift; |
21
|
7
|
100
|
|
|
|
56
|
$v =~ $re ? 1:0; |
22
|
|
|
|
|
|
|
} |
23
|
|
|
|
|
|
|
|
24
|
|
|
|
|
|
|
sub inc_version { |
25
|
2
|
|
|
2
|
1
|
783
|
my ($v, $inc_compat) = @_; |
26
|
|
|
|
|
|
|
|
27
|
2
|
50
|
|
|
|
16
|
my ($compat, $rel, $zero) = $v =~ $re |
28
|
|
|
|
|
|
|
or die "Invalid monotonic version '$v'"; |
29
|
2
|
100
|
|
|
|
6
|
$compat++ if $inc_compat; |
30
|
2
|
|
|
|
|
2
|
$rel++; |
31
|
2
|
|
50
|
|
|
16
|
"$compat.$rel".($zero || ""); |
32
|
|
|
|
|
|
|
} |
33
|
|
|
|
|
|
|
|
34
|
|
|
|
|
|
|
1; |
35
|
|
|
|
|
|
|
# ABSTRACT: Utility routines related to monotonic versioning |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
__END__ |