X-Git-Url: http://git.vpit.fr/?p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git;a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FVersion.pm;h=d76bcb47df96ef041db48f4deb8253c3dfbf60dc;hp=e1f76742748fd777436c47b9af84068a81e76366;hb=400c6076d23a0fa83acac09fc3351653c527cb65;hpb=7bee20385150f2ebb608178ecdce3851cdc4f54f diff --git a/lib/CPANPLUS/Dist/Gentoo/Version.pm b/lib/CPANPLUS/Dist/Gentoo/Version.pm index e1f7674..d76bcb4 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Version.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Version.pm @@ -126,13 +126,26 @@ sub _spaceship { my @a = @{ $v1->version }; my @b = @{ $v2->version }; - while (@a and @b) { + { my $x = shift @a; my $y = shift @b; my $c = $x <=> $y; return $c if $c; } + while (@a and @b) { + my $x = shift @a; + my $y = shift @b; + my $c; + if ($x =~ /^0/ or $y =~ /^0/) { + s/0+\z// for $x, $y; + $c = $x cmp $y; + } else { + $c = $x <=> $y; + } + return $c if $c; + } + return 1 if @a; return -1 if @b; }