File Coverage

blib/lib/OrePAN2/CLI/Indexer.pm
Criterion Covered Total %
statement 33 34 97.0
branch 2 4 50.0
condition n/a
subroutine 9 9 100.0
pod 0 2 0.0
total 44 49 89.8


line stmt bran cond sub pod time code
1             package OrePAN2::CLI::Indexer;
2              
3 1     1   29054 use strict;
  1         2  
  1         26  
4 1     1   3 use warnings;
  1         2  
  1         39  
5 1     1   5 use utf8;
  1         1  
  1         5  
6              
7 1     1   674 use Getopt::Long ();
  1         9414  
  1         28  
8 1     1   293 use OrePAN2 ();
  1         6  
  1         17  
9 1     1   325 use OrePAN2::Indexer ();
  1         6  
  1         53  
10 1     1   777 use Pod::Usage qw( pod2usage );
  1         79949  
  1         499  
11              
12             sub new {
13 3     3 0 427829 my $class = shift;
14 3         88 bless {}, $class;
15             }
16              
17             sub run {
18 3     3 0 77 my ( $self, @args ) = @_;
19              
20 3         15 my $version;
21             my $text;
22 3         0 my $metacpan;
23 3         9 my $simple = 0;
24              
25 3         38 my $p = Getopt::Long::Parser->new(
26             config => [qw(posix_default no_ignore_case auto_help)] );
27 3         2190 $p->getoptionsfromarray(
28             \@args => (
29             'metacpan!' => \$metacpan,
30             'version!' => \$version,
31             'text!' => \$text,
32             'simple!' => \$simple,
33             )
34             );
35 3 50       2133 if ($version) {
36 0         0 print "orepan2: $OrePAN2::VERSION\n";
37             }
38 3 50       34 my $directory = shift @args or pod2usage(
39             -input => $0,
40             );
41 3         88 my $orepan = OrePAN2::Indexer->new(
42             directory => $directory,
43             metacpan => $metacpan,
44             simple => $simple,
45             );
46 3         6860 $orepan->make_index(
47             no_compress => $text,
48             );
49             }
50              
51             1;