| 1 | package Alien::Build::Version::Basic; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | 2 | ▶ | use strict; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 4 | 2 | ▶ | use warnings; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 5 | 2 | ▶ | use 5.008004; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 2 | ▶ | use Carp (); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | 2 | ▶ | use Exporter qw( import ); | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 8 | use overload | ||||||||||||||||||||||||||||
| 9 | 37 | ▶ | '<=>' => sub { shift->cmp(@_) }, | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 10 | 7 | ▶ | 'cmp' => sub { shift->cmp(@_) }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 11 | 2 | ▶ | '""' => sub { shift->as_string }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 12 | 0 | ▶ | bool => sub { 1 }, | ||||||||||||||||||||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||||||||||||||||||||
| 13 | 2 | fallback => 1; | |||||||||||||||||||||||||||
| 14 | |||||||||||||||||||||||||||||
| 15 | 2 | our @EXPORT_OK = qw( version ); | |||||||||||||||||||||||||||
| 16 | |||||||||||||||||||||||||||||
| 17 | # ABSTRACT: Very basic version object for Alien::Build | ||||||||||||||||||||||||||||
| 18 | 2 | our $VERSION = '2.88'; # VERSION | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | sub new | ||||||||||||||||||||||||||||
| 22 | 56 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
new: called CC=2 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 56 | my($class, $value) = @_; | |||||||||||||||||||||||||||
| 24 | 56 | $value =~ s/\.$//; # trim trailing dot | |||||||||||||||||||||||||||
| 25 | 56 | ▶ | Carp::croak("invalud version: $value") | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 26 | unless $value =~ /^[0-9]+(\.[0-9]+)*$/; | ||||||||||||||||||||||||||||
| 27 | 52 | bless \$value, $class; | |||||||||||||||||||||||||||
| 28 | } | ||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | |||||||||||||||||||||||||||||
| 31 | sub version ($) | ||||||||||||||||||||||||||||
| 32 | 55 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
version: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 55 | my($value) = @_; | |||||||||||||||||||||||||||
| 34 | 55 | __PACKAGE__->new($value); | |||||||||||||||||||||||||||
| 35 | } | ||||||||||||||||||||||||||||
| 36 | |||||||||||||||||||||||||||||
| 37 | |||||||||||||||||||||||||||||
| 38 | sub as_string | ||||||||||||||||||||||||||||
| 39 | 4 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
as_string: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 40 | 4 | my($self) = @_; | |||||||||||||||||||||||||||
| 41 | 4 | "@{[ $$self ]}"; | |||||||||||||||||||||||||||
| 42 | } | ||||||||||||||||||||||||||||
| 43 | |||||||||||||||||||||||||||||
| 44 | |||||||||||||||||||||||||||||
| 45 | sub cmp | ||||||||||||||||||||||||||||
| 46 | 51 | ▶ | { | ||||||||||||||||||||||||||
|
Subroutine
cmp: called CC=7 SCAR=19.5
Pod
documented
| |||||||||||||||||||||||||||||
| 47 | 51 | my @x = split /\./, ${$_[0]}; | |||||||||||||||||||||||||||
| 48 | 51 | ▶ | my @y = split /\./, ${ref($_[1]) ? $_[1] : version($_[1])}; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 49 | |||||||||||||||||||||||||||||
| 50 | 48 | ▶ | while(@x or @y) | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition100%3/3
@x or @y
MC/DC100%2/2
@x or @y
@x
@y
Truth table100%3/3
A or B
A= @xB= @y
| |||||||||||||||||||||||||||||
| 51 | { | ||||||||||||||||||||||||||||
| 52 | 165 | ▶ | my $x = (shift @x) || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift @x || 0
MC/DC100%1/1
shift @x || 0
shift @x
Truth table100%2/2
A
A= shift @x
| |||||||||||||||||||||||||||||
| 53 | 165 | ▶ | my $y = (shift @y) || 0; | ||||||||||||||||||||||||||
|
Condition100%2/2
shift @y || 0
MC/DC100%1/1
shift @y || 0
shift @y
Truth table100%2/2
A
A= shift @y
| |||||||||||||||||||||||||||||
| 54 | 165 | ▶ | return $x <=> $y if $x <=> $y; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 24 | 0; | |||||||||||||||||||||||||||
| 58 | } | ||||||||||||||||||||||||||||
| 59 | |||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | 2 | 1; | |||||||||||||||||||||||||||
| 62 | |||||||||||||||||||||||||||||
| 63 | __END__ | ||||||||||||||||||||||||||||