Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Implemented -f and -t

  • Loading branch information...
commit f24942d0176e7c0a0a7c17d0b4e5fd4e824d8bce 1 parent 4e0a4ef
@miyagawa authored
Showing with 13 additions and 4 deletions.
  1. +13 −4 lib/App/CPAN/Fresh.pm
View
17 lib/App/CPAN/Fresh.pm
@@ -20,6 +20,8 @@ sub opt_spec {
return (
[ "install|i", "install the module" ],
[ "list|l", "list the recent uploads" ],
+ [ "test|t", "test the dist" ],
+ [ "force|f", "force install" ],
[ "help|h", "displays usage info" ],
);
}
@@ -34,7 +36,7 @@ sub execute {
} elsif ($opt->{help} || !@$args) {
$self->usage;
} else {
- $self->install($args);
+ $self->handle($opt, $args);
}
}
@@ -55,8 +57,8 @@ sub usage {
Pod::Usage::pod2usage(0);
}
-sub install {
- my($self, $dists) = @_;
+sub handle {
+ my($self, $opt, $dists) = @_;
my @install;
for my $dist (@$dists) {
@@ -69,9 +71,16 @@ sub install {
}
}
+ my $method = "install";
+ $method = "test" if $opt->{test};
+
if (@install) {
require CPAN;
- CPAN::Shell->install(@install);
+ if ($opt->{force}) {
+ CPAN::Shell->force($method, @install);
+ } else {
+ CPAN::Shell->$method(@install);
+ }
}
}
Please sign in to comment.
Something went wrong with that request. Please try again.