X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FVersion.pm;h=e1f76742748fd777436c47b9af84068a81e76366;hb=7bee20385150f2ebb608178ecdce3851cdc4f54f;hp=bce74eadd906bac4f472bf34817035d8a1016682;hpb=f7846983c923e0aac6f815d8c494fbd958cb3fbe;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo/Version.pm b/lib/CPANPLUS/Dist/Gentoo/Version.pm index bce74ea..e1f7674 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Version.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Version.pm @@ -9,11 +9,11 @@ CPANPLUS::Dist::Gentoo::Version - Gentoo version object. =head1 VERSION -Version 0.10 +Version 0.11 =cut -our $VERSION = '0.10'; +our $VERSION = '0.11'; =head1 DESCRIPTION @@ -33,7 +33,7 @@ my $positive_int_rx = qr/0*[1-9][0-9]*/; my $letter_rx = qr/[a-zA-Z]/; my $dotted_num_rx = qr/$int_rx(?:\.$int_rx)*/o; -my @suffixes = qw(alpha beta pre rc normal p); +my @suffixes = qw; my $suffix_rx = join '|', grep !/^normal$/, @suffixes; $suffix_rx = qr/(?:$suffix_rx)/o; @@ -86,7 +86,7 @@ sub new { my @parts; BEGIN { - @parts = qw/version letter suffixes revision/; + @parts = qw; eval "sub $_ { \$_[0]->{$_} }" for @parts; } @@ -126,12 +126,15 @@ sub _spaceship { my @a = @{ $v1->version }; my @b = @{ $v2->version }; - while (@a or @b) { - my $x = shift(@a) || 0; - my $y = shift(@b) || 0; + while (@a and @b) { + my $x = shift @a; + my $y = shift @b; my $c = $x <=> $y; return $c if $c; } + + return 1 if @a; + return -1 if @b; } { @@ -188,7 +191,7 @@ sub _stringify { =pod -This class provides overloaded methods for numerical comparison and strigification. +This class provides overloaded methods for numerical comparison and stringification. =head1 SEE ALSO