Subject: | Add support for searching 02packages.details.txt.gz |
Attached is a patch that modifies the search_module subroutine so that it
will search the 02packages.details.txt.gz of each mirror for the module.
This is especially useful while on a plane without Interwebs, but with a
CPAN::Mini repository available. (I wrote this on the plane for this very
reason.)
I posted it to a fork on github as well.
Subject: | 0001-Add-support-for-reading-package-details-of-mirrors.patch |
From 67992d707bad00d6970470e3ab780e2f8b2c1903 Mon Sep 17 00:00:00 2001
From: Sterling Hanenkamp <hanenkamp@cpan.org>
Date: Fri, 2 Jul 2010 22:44:19 -0500
Subject: [PATCH] Add support for reading package details of mirrors
This is required to make CPAN::Mini repositories usable as mirrors.
---
lib/App/cpanminus/script.pm | 10 ++++++++++
1 files changed, 10 insertions(+), 0 deletions(-)
diff --git a/lib/App/cpanminus/script.pm b/lib/App/cpanminus/script.pm
index 62ccea0..6342280 100644
--- a/lib/App/cpanminus/script.pm
+++ b/lib/App/cpanminus/script.pm
@@ -183,6 +183,16 @@ sub search_module {
$self->diag_fail("Finding $module on search.cpan.org failed.");
+ for my $mirror (@{ $self->{mirrors} }) {
+ $self->chat("Searching $module on mirror $mirror ...\n");
+ my $uri = "$mirror/modules/02packages.details.txt.gz";
+ my $details = $self->get($uri);
+ $details =~ m!^\Q$module\E\s+[\w\.]+\s+(.*)!m
+ and return $self->cpan_module($module, $1);
+
+ $self->diag_fail("Finding $module on mirror $mirror failed.");
+ }
+
return;
}
--
1.6.0.4