r55209 - in /trunk/dh-make-perl/lib: Debian/Control/FromCPAN.pm DhMakePerl/Command/make.pm DhMakePerl/Utils.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Wed Mar 31 05:57:58 UTC 2010
Author: dmn
Date: Wed Mar 31 05:56:22 2010
New Revision: 55209
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=55209
Log:
move find_cpan_module from ::make to ::Utils
Modified:
trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm
trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm
trunk/dh-make-perl/lib/DhMakePerl/Utils.pm
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=55209&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm (original)
+++ trunk/dh-make-perl/lib/Debian/Control/FromCPAN.pm Wed Mar 31 05:56:22 2010
@@ -18,8 +18,9 @@
use base 'Debian::Control';
+use CPAN ();
use Debian::Version qw(deb_ver_cmp);
-use DhMakePerl::Utils qw(is_core_module);
+use DhMakePerl::Utils qw( is_core_module find_cpan_module );
use File::Spec qw( catfile );
use Module::Depends ();
@@ -290,7 +291,7 @@
print "- $module not found in any package\n";
push @missing, $module;
- my $mod = $self->find_cpan_module($module);
+ my $mod = find_cpan_module($module);
if ($mod) {
( my $dist = $mod->distribution->base_id ) =~ s/-v?\d[^-]*$//;
my $pkg = 'lib' . lc($dist) . '-perl';
Modified: trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm?rev=55209&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Command/make.pm Wed Mar 31 05:56:22 2010
@@ -50,7 +50,7 @@
use Debian::Dependencies ();
use Debian::Dependency ();
use Debian::WNPP::Query;
-use DhMakePerl::Utils qw(is_core_module);
+use DhMakePerl::Utils qw( find_cpan_module is_core_module );
use Email::Date::Format qw(email_date);
use File::Basename qw( basename dirname );
use File::Copy qw( copy move );
@@ -210,40 +210,6 @@
= $self->cfg->verbose ? 'verbose' : 'silent';
}
-=item find_cpan_module
-
-Returns CPAN::Module object that corresponds to the supplied argument. Returns undef if no module is found by CPAN.
-
-=cut
-
-sub find_cpan_module {
- my( $self, $name ) = @_;
-
- my $mod;
-
- # expand() returns a list of matching items when called in list
- # context, so after retrieving it, we try to match exactly what
- # the user asked for. Specially important when there are
- # different modules which only differ in case.
- #
- # This Closes: #451838
- my @mod = CPAN::Shell->expand( 'Module', '/^' . $name . '$/' );
-
- foreach (@mod) {
- my $file = $_->cpan_file();
- $file =~ s#.*/##; # remove directory
- $file =~ s/(.*)-.*/$1/; # remove version and extension
- $file =~ s/-/::/g; # convert dashes to colons
- if ( $self->cfg->cpan and $file eq $self->cfg->cpan ) {
- $mod = $_;
- last;
- }
- }
- $mod = shift @mod unless ($mod);
-
- return $mod;
-}
-
sub setup_dir {
my ($self) = @_;
@@ -264,7 +230,7 @@
$self->configure_cpan;
- $mod = $self->find_cpan_module( $self->cfg->cpan )
+ $mod = find_cpan_module( $self->cfg->cpan )
or die "Can't find '" . $self->cfg->cpan . "' module on CPAN\n";
$self->mod_cpan_version( $mod->cpan_version );
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=55209&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl/Utils.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl/Utils.pm Wed Mar 31 05:56:22 2010
@@ -12,7 +12,7 @@
=cut
-our @EXPORT_OK = qw( is_core_module );
+our @EXPORT_OK = qw( find_cpan_module is_core_module );
use base Exporter;
@@ -23,6 +23,41 @@
None of he following functions is exported by default.
=over
+
+=item find_cpan_module
+
+Returns CPAN::Module object that corresponds to the supplied argument. Returns
+undef if no module is found by CPAN.
+
+=cut
+
+sub find_cpan_module {
+ my( $name ) = @_;
+
+ my $mod;
+
+ # expand() returns a list of matching items when called in list
+ # context, so after retrieving it, we try to match exactly what
+ # the user asked for. Specially important when there are
+ # different modules which only differ in case.
+ #
+ # This Closes: #451838
+ my @mod = CPAN::Shell->expand( 'Module', '/^' . $name . '$/' );
+
+ foreach (@mod) {
+ my $file = $_->cpan_file();
+ $file =~ s#.*/##; # remove directory
+ $file =~ s/(.*)-.*/$1/; # remove version and extension
+ $file =~ s/-/::/g; # convert dashes to colons
+ if ( $file eq $name ) {
+ $mod = $_;
+ last;
+ }
+ }
+ $mod = shift @mod unless ($mod);
+
+ return $mod;
+}
=item is_core_module I<module>, I<version>
More information about the Pkg-perl-cvs-commits
mailing list