X-Git-Url: http://git.vpit.fr/?a=blobdiff_plain;f=lib%2FCPANPLUS%2FDist%2FGentoo%2FMaps.pm;h=1aa7d85458442f641dcf21d7fa48e466778a853e;hb=77110d525f6b966b8f87c11669f177127e6930d9;hp=fa87c8a72ebf8fe35215bf24fbd56f3293389213;hpb=2bd32904bf699aae0d031237b258dbf6416d79b3;p=perl%2Fmodules%2FCPANPLUS-Dist-Gentoo.git diff --git a/lib/CPANPLUS/Dist/Gentoo/Maps.pm b/lib/CPANPLUS/Dist/Gentoo/Maps.pm index fa87c8a..1aa7d85 100644 --- a/lib/CPANPLUS/Dist/Gentoo/Maps.pm +++ b/lib/CPANPLUS/Dist/Gentoo/Maps.pm @@ -9,11 +9,11 @@ CPANPLUS::Dist::Gentoo::Maps - Map CPAN objects to Gentoo and vice versa. =head1 VERSION -Version 0.09 +Version 0.10 =cut -our $VERSION = '0.09'; +our $VERSION = '0.10'; =head1 DESCRPITON @@ -95,6 +95,31 @@ sub version_c2g { return $v; } +=head2 C + +Converts a perl version as you can find it in prerequisites to a Gentoo version number. + +=cut + +sub perl_version_c2g { + my ($v) = @_; + + return unless defined $v and $v =~ /^[0-9\.]+$/; + + my @parts; + if (my ($version, $subversion) = $v =~ /^([0-9]+)\.(0[^\.]+)$/) { + my $len = length $subversion; + if (my $pad = $len % 3) { + $subversion .= '0' x (3 - $pad); + } + @parts = ($version, $subversion =~ /(.{1,3})/g); + } else { + @parts = split /\./, $v; + } + + return join '.', map int, @parts; +} + =head1 SEE ALSO L.