r34703 - in /trunk/dh-make-perl: debian/changelog lib/DhMakePerl.pm
dmn at users.alioth.debian.org
dmn at users.alioth.debian.org
Sun May 3 16:03:17 UTC 2009
Author: dmn
Date: Sun May 3 16:03:12 2009
New Revision: 34703
URL: http://svn.debian.org/wsvn/pkg-perl/?sc=1&rev=34703
Log:
move finding CPAN module object for given module name into a method
Modified:
trunk/dh-make-perl/debian/changelog
trunk/dh-make-perl/lib/DhMakePerl.pm
Modified: trunk/dh-make-perl/debian/changelog
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/debian/changelog?rev=34703&op=diff
==============================================================================
--- trunk/dh-make-perl/debian/changelog (original)
+++ trunk/dh-make-perl/debian/changelog Sun May 3 16:03:12 2009
@@ -19,6 +19,7 @@
* remove code supporting CPAN < 1.9205, which is what ships with
perl-modules 5.10 (on which we already depend)
* move CPAN configuration into a method
+ * move finding CPAN module object for given module name into a method
-- gregor herrmann <gregoa at debian.org> Mon, 27 Apr 2009 16:42:59 +0200
Modified: trunk/dh-make-perl/lib/DhMakePerl.pm
URL: http://svn.debian.org/wsvn/pkg-perl/trunk/dh-make-perl/lib/DhMakePerl.pm?rev=34703&op=diff
==============================================================================
--- trunk/dh-make-perl/lib/DhMakePerl.pm (original)
+++ trunk/dh-make-perl/lib/DhMakePerl.pm Sun May 3 16:03:12 2009
@@ -381,6 +381,40 @@
= $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 ( $file eq $self->cfg->cpan ) {
+ $mod = $_;
+ last;
+ }
+ }
+ $mod = shift @mod unless ($mod);
+
+ return $mod;
+}
+
sub setup_dir {
my ($self) = @_;
@@ -398,28 +432,8 @@
$self->configure_cpan;
- # This modification allows to retrieve all the modules that
- # match the user-provided string.
- #
- # expand() returns a list of matching items when called in list
- # context, so after retrieving it, I 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', '/^' . $self->cfg->cpan . '$/' )
+ $mod = $self->find_cpan_module( $self->cfg->cpan )
or die "Can't find '" . $self->cfg->cpan . "' module on CPAN\n";
- 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 $self->cfg->cpan ) {
- $mod = $_;
- last;
- }
- }
- $mod = shift @mod unless ($mod);
$mod_cpan_version = $mod->cpan_version;
$tarball = $CPAN::Config->{'keep_source_where'} . "/authors/id/";
More information about the Pkg-perl-cvs-commits
mailing list