Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Merge branch 'master' of github.com:miyagawa/carton

  • Loading branch information...
commit 491cee30e014700460d19353f9b911b1a80c78ec 2 parents 33af4ce + 9fbc3b0
@miyagawa miyagawa authored
Showing with 42 additions and 2 deletions.
  1. +8 −2 lib/Carton.pm
  2. +34 −0 xt/cli/mirror_multi.t
View
10 lib/Carton.pm
@@ -134,11 +134,17 @@ sub install_conservative {
my $mirror = $self->{mirror} || $DefaultMirror;
+ my $is_default_mirror = 0;
+ if ( !ref $mirror ) {
+ $is_default_mirror = $mirror eq $DefaultMirror ? 1 : 0;
+ $mirror = [split /,/, $mirror];
+ }
+
$self->run_cpanm(
- "--mirror", $mirror,
+ (map { ("--mirror", $_) } @{$mirror}),
"--mirror", "http://backpan.perl.org/", # fallback
"--skip-satisfied",
- ( $mirror ne $DefaultMirror ? "--mirror-only" : () ),
+ ( $is_default_mirror ? () : "--mirror-only" ),
( $self->lock ? ("--mirror-index", $self->{mirror_file}) : () ),
( $cascade ? "--cascade-search" : () ),
@$modules,
View
34 xt/cli/mirror_multi.t
@@ -0,0 +1,34 @@
+use strict;
+use Test::More;
+use xt::CLI;
+use Cwd;
+
+my $cwd = Cwd::cwd();
+
+{
+ # split string
+ my $app = cli();
+
+ $app->carton->{mirror} = "$cwd/xt/mirror,http://cpan.metacpan.org/";
+ $app->run("install", "PSGI");
+
+ $app->run("list");
+ like $app->output, qr/^PSGI-/;
+}
+
+{
+ # ARRAY ref
+ my $app = cli();
+
+ $app->carton->{mirror} = ["$cwd/xt/mirror", "http://cpan.metacpan.org/"];
+ $app->run("install", "PSGI");
+
+ $app->run("list");
+ like $app->output, qr/^PSGI-/;
+}
+
+
+done_testing;
+
+
+
Please sign in to comment.
Something went wrong with that request. Please try again.