Permalink
Browse files

Continue searching module if cascade search is on. #150

  • Loading branch information...
1 parent 7e079af commit 8f228ff6ecc52ce5d7e49f18165cf93657dcec5d @miyagawa committed May 12, 2012
Showing with 12 additions and 5 deletions.
  1. +3 −2 lib/App/cpanminus/script.pm
  2. +2 −2 script/cpanm.PL
  3. +7 −1 xt/cascade_search.t
@@ -311,11 +311,12 @@ sub search_module {
if ($self->{mirror_index}) {
$self->chat("Searching $module on mirror index $self->{mirror_index} ...\n");
my $pkg = $self->search_mirror_index_file($self->{mirror_index}, $module, $version);
- if (not $pkg) {
+ return $pkg if $pkg;
+
+ unless ($self->{cascade_search}) {
$self->diag_fail("Finding $module ($version) on mirror index $self->{mirror_index} failed.");
return;
}
- return $pkg;
}
unless ($self->{mirror_only}) {
View
@@ -310,8 +310,8 @@ library path.
=item --cascade-search
B<EXPERIMENTAL>: Specifies whether to cascade search when you specify
-multiple mirrors and a mirror has a lower version of the module than
-requested. Defaults to false.
+multiple mirrors and a mirror doesn't have a module or has a lower
+version of the module than requested. Defaults to false.
=item --skip-installed
View
@@ -10,6 +10,12 @@ run "-L", $local_lib, "--mirror-index", "xt/mirror.txt", "--skip-installed", "Ha
like last_build_log, qr/Hash::MultiValue is up to date/;
run "-L", $local_lib, "--mirror-index", "xt/mirror.txt", "--skip-installed", "--cascade-search", "Hash::MultiValue~0.03";
-like last_build_log, qr/Couldn't find .* Hash::MultiValue/;
+like last_build_log, qr/installed Hash-MultiValue-/;
+
+run "-L", $local_lib, "--mirror-index", "xt/mirror.txt", "--skip-installed", "Try::Tiny";
+like last_build_log, qr/Couldn't find .* Try::Tiny/;
+
+run "-L", $local_lib, "--mirror-index", "xt/mirror.txt", "--skip-installed", "--cascade-search", "Try::Tiny";
+like last_build_log, qr/installed Try-Tiny/;
done_testing;

0 comments on commit 8f228ff

Please sign in to comment.