Permalink
Browse files

Implemented -f and -t

  • Loading branch information...
1 parent 4e0a4ef commit f24942d0176e7c0a0a7c17d0b4e5fd4e824d8bce @miyagawa committed Sep 2, 2009
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);
+ }
}
}

0 comments on commit f24942d

Please sign in to comment.