Permalink
Browse files

output format for cpanm (--list options) #1

  • Loading branch information...
1 parent ca6a577 commit 6faa84eded94274f9249e44d31ffdb538ed53ead @punytan committed Jan 17, 2012
Showing with 10 additions and 2 deletions.
  1. +8 −1 bin/extractused
  2. +2 −1 lib/App/ExtractUsed/Script.pm
View
@@ -12,11 +12,12 @@ my $args = {
dir => [],
file => [],
perl => '',
+ list => 0,
help => 0,
version => 0,
};
-GetOptions($args, qw< skip=s% perl=s dir=s% file=s% help version >);
+GetOptions($args, qw< skip=s% perl=s dir=s% file=s% list help version >);
if ($args->{help}) {
pod2usage(1);
@@ -40,6 +41,8 @@ extractused - CLI tool to extract used modules from your project.
$ extractused --skip YourProject
$ extractused --file lib/YourProject.pm --skip YourProject
+ $ extractused --file write-once.pl --list | cpanm
+
$ extractused --help
$ extractused --version
@@ -63,6 +66,10 @@ directory
path to the file
+=item B<--list>
+
+Output format for cpanm (or other command)
+
=item B<--help>
brief help message
@@ -20,6 +20,7 @@ sub new {
bless {
dir => $args->{dir},
file => $args->{file},
+ list => $args->{list},
extract => $extract,
}, $class;
}
@@ -49,7 +50,7 @@ sub run {
? "test_requires" : "requires";
for my $module ($self->{extract}->from_file($file)) {
- push @lines, qq{$sub '$module';};
+ push @lines, $self->{list} ? $module : qq{$sub '$module';};
}
}

0 comments on commit 6faa84e

Please sign in to comment.