line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package Alien::Build::Version::Basic; |
2
|
|
|
|
|
|
|
|
3
|
2
|
|
|
2
|
|
186641
|
use strict; |
|
2
|
|
|
|
|
8
|
|
|
2
|
|
|
|
|
50
|
|
4
|
2
|
|
|
2
|
|
16
|
use warnings; |
|
2
|
|
|
|
|
6
|
|
|
2
|
|
|
|
|
40
|
|
5
|
2
|
|
|
2
|
|
42
|
use 5.008004; |
|
2
|
|
|
|
|
6
|
|
6
|
2
|
|
|
2
|
|
8
|
use Carp (); |
|
2
|
|
|
|
|
5
|
|
|
2
|
|
|
|
|
50
|
|
7
|
2
|
|
|
2
|
|
9
|
use Exporter qw( import ); |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
260
|
|
8
|
|
|
|
|
|
|
use overload |
9
|
37
|
|
|
37
|
|
5081
|
'<=>' => sub { shift->cmp(@_) }, |
10
|
7
|
|
|
7
|
|
348
|
'cmp' => sub { shift->cmp(@_) }, |
11
|
2
|
|
|
2
|
|
6
|
'""' => sub { shift->as_string }, |
12
|
0
|
|
|
0
|
|
0
|
bool => sub { 1 }, |
13
|
2
|
|
|
2
|
|
12
|
fallback => 1; |
|
2
|
|
|
|
|
3
|
|
|
2
|
|
|
|
|
34
|
|
14
|
|
|
|
|
|
|
|
15
|
|
|
|
|
|
|
our @EXPORT_OK = qw( version ); |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
# ABSTRACT: Very basic version object for Alien::Build |
18
|
|
|
|
|
|
|
our $VERSION = '2.47'; # VERSION |
19
|
|
|
|
|
|
|
|
20
|
|
|
|
|
|
|
|
21
|
|
|
|
|
|
|
sub new |
22
|
|
|
|
|
|
|
{ |
23
|
56
|
|
|
56
|
1
|
6035
|
my($class, $value) = @_; |
24
|
56
|
|
|
|
|
109
|
$value =~ s/\.$//; # trim trailing dot |
25
|
56
|
100
|
|
|
|
799
|
Carp::croak("invalud version: $value") |
26
|
|
|
|
|
|
|
unless $value =~ /^[0-9]+(\.[0-9]+)*$/; |
27
|
52
|
|
|
|
|
165
|
bless \$value, $class; |
28
|
|
|
|
|
|
|
} |
29
|
|
|
|
|
|
|
|
30
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
sub version ($) |
32
|
|
|
|
|
|
|
{ |
33
|
55
|
|
|
55
|
1
|
17569
|
my($value) = @_; |
34
|
55
|
|
|
|
|
106
|
__PACKAGE__->new($value); |
35
|
|
|
|
|
|
|
} |
36
|
|
|
|
|
|
|
|
37
|
|
|
|
|
|
|
|
38
|
|
|
|
|
|
|
sub as_string |
39
|
|
|
|
|
|
|
{ |
40
|
4
|
|
|
4
|
1
|
979
|
my($self) = @_; |
41
|
4
|
|
|
|
|
5
|
"@{[ $$self ]}"; |
|
4
|
|
|
|
|
46
|
|
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
|
45
|
|
|
|
|
|
|
sub cmp |
46
|
|
|
|
|
|
|
{ |
47
|
51
|
|
|
51
|
1
|
68
|
my @x = split /\./, ${$_[0]}; |
|
51
|
|
|
|
|
146
|
|
48
|
51
|
100
|
|
|
|
96
|
my @y = split /\./, ${ref($_[1]) ? $_[1] : version($_[1])}; |
|
51
|
|
|
|
|
129
|
|
49
|
|
|
|
|
|
|
|
50
|
48
|
|
100
|
|
|
110
|
while(@x or @y) |
51
|
|
|
|
|
|
|
{ |
52
|
165
|
|
100
|
|
|
292
|
my $x = (shift @x) || 0; |
53
|
165
|
|
100
|
|
|
239
|
my $y = (shift @y) || 0; |
54
|
165
|
100
|
|
|
|
480
|
return $x <=> $y if $x <=> $y; |
55
|
|
|
|
|
|
|
} |
56
|
|
|
|
|
|
|
|
57
|
24
|
|
|
|
|
98
|
0; |
58
|
|
|
|
|
|
|
} |
59
|
|
|
|
|
|
|
|
60
|
|
|
|
|
|
|
|
61
|
|
|
|
|
|
|
1; |
62
|
|
|
|
|
|
|
|
63
|
|
|
|
|
|
|
__END__ |