r56136 - in /trunk/dh-make-perl: lib/Debian/Control/FromCPAN.pm lib/DhMakePerl/Utils.pm t/perl-versions.t
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Thu Apr 15 20:30:19 UTC 2010
Author: dmn
Date: Thu Apr 15 20:30:10 2010
New Revision: 56136
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=56136
Log:
move nice_perl_ver from Control::FromCPAN to Utils
it is not specific to Debian::Control::FromCPAN and is
needed elsewhere
Modified:
trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
trunk/dh-make-perl/lib/DhMakePerl/Utils.pm
trunk/dh-make-perl/t/perl-versions.t
Modified: trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm?rev=56136&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm Thu Apr 15 20:30:10 2010
@@ -20,7 +20,7 @@
use CPAN ();
use Debian::Version qw(deb_ver_cmp);
-use DhMakePerl::Utils qw( is_core_module find_cpan_module );
+use DhMakePerl::Utils qw( is_core_module find_cpan_module nice_perl_ver );
use File::Spec qw( catfile );
use Module::Depends ();
@@ -276,7 +276,7 @@
my $dep;
if ( $module eq 'perl' ) {
$dep = Debian::Dependency->new( 'perl',
- $self->nice_perl_ver( $dep_hash->{$module} ) );
+ nice_perl_ver( $dep_hash->{$module} ) );
}
elsif ($apt_contents) {
$dep = $apt_contents->find_perl_module_package( $module,
@@ -465,35 +465,6 @@
}
}
-=item nice_perl_ver I<version_string>
-
-Reformats perl version to match Debian's perl package versions.
-
-For example C<5.010> (and C<5.01>) is converted to C<5.10>.
-
-=cut
-
-sub nice_perl_ver {
- my( $self, $v ) = @_;
-
- if( $v =~ /\.(\d+)$/ and $v !~ /\..+\./ ) { # do nothing for 5.9.1
- my $minor = $1;
- if( length($minor) % 3 ) {
- # right-pad with zeroes so that the number of digits after the dot
- # is a multiple of 3
- $minor .= '0' x ( 3 - length($minor) % 3 );
- }
-
- my $ver = 0 + substr( $minor, 0, 3 );
- if( length($minor) > 3 ) {
- $ver .= '.' . ( 0 + substr( $minor, 3 ) );
- }
- $v =~ s/\.\d+$/.$ver/;
- }
-
- return $v;
-}
-
=back
=head1 COPYRIGHT & LICENSE
Modified: trunk/dh-make-perl/lib/DhMakePerl/Utils.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Utils.pm?rev=56136&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Utils.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Utils.pm Thu Apr 15 20:30:10 2010
@@ -9,10 +9,11 @@
use DhMakePerl::Utils qw(is_core_module);
my $v = is_core_module('Test::More', '1.002');
+ my $v = nice_perl_ver('5.010001');
=cut
-our @EXPORT_OK = qw( find_cpan_module is_core_module );
+our @EXPORT_OK = qw( find_cpan_module is_core_module nice_perl_ver );
use base Exporter;
@@ -84,6 +85,35 @@
return $v;
}
+=item nice_perl_ver I<version_string>
+
+Reformats perl version to match Debian's perl package versions.
+
+For example C<5.010> (and C<5.01>) is converted to C<5.10>.
+
+=cut
+
+sub nice_perl_ver {
+ my( $v ) = @_;
+
+ if( $v =~ /\.(\d+)$/ and $v !~ /\..+\./ ) { # do nothing for 5.9.1
+ my $minor = $1;
+ if( length($minor) % 3 ) {
+ # right-pad with zeroes so that the number of digits after the dot
+ # is a multiple of 3
+ $minor .= '0' x ( 3 - length($minor) % 3 );
+ }
+
+ my $ver = 0 + substr( $minor, 0, 3 );
+ if( length($minor) > 3 ) {
+ $ver .= '.' . ( 0 + substr( $minor, 3 ) );
+ }
+ $v =~ s/\.\d+$/.$ver/;
+ }
+
+ return $v;
+}
+
=back
=head1 COPYRIGHT & LICENSE
Modified: trunk/dh-make-perl/t/perl-versions.t
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/t/perl-versions.t?rev=56136&op=diff
==============================================================================
--- trunk/dh-make-perl/t/perl-versions.t (original)
+++ trunk/dh-make-perl/t/perl-versions.t Thu Apr 15 20:30:10 2010
@@ -6,13 +6,13 @@
use Test::More tests => 22;
BEGIN {
- use_ok('Debian::Control::FromCPAN');
+ use_ok('DhMakePerl::Utils');
};
sub check {
my( $src, $dst ) = @_;
- is( Debian::Control::FromCPAN->nice_perl_ver($src), $dst, "perl version '$src' corresponds to Debian package version '$dst'" );
+ is( DhMakePerl::Utils::nice_perl_ver($src), $dst, "perl version '$src' corresponds to Debian package version '$dst'" );
}
check( '5.006002', '5.6.2' );
More information about the Pkg-perl-cvs-commits
mailing list