File Coverage

blib/lib/AnyPAN/CLI/FileStorage.pm
Criterion Covered Total %
statement 18 28 64.2
branch 0 2 0.0
condition n/a
subroutine 6 9 66.6
pod 0 3 0.0
total 24 42 57.1


line stmt bran cond sub pod time code
1             package AnyPAN::CLI::FileStorage;
2 1     1   1580 use strict;
  1         4  
  1         30  
3 1     1   5 use warnings;
  1         2  
  1         28  
4              
5 1     1   5 use parent qw/AnyPAN::CLI/;
  1         2  
  1         5  
6              
7 1     1   59 use Class::Accessor::Lite ro => [qw/output_dir/];
  1         3  
  1         8  
8              
9 1     1   78 use Pod::Usage qw/pod2usage/;
  1         2  
  1         81  
10 1     1   423 use AnyPAN::Storage::Directory;
  1         3  
  1         173  
11              
12             sub create_option_specs {
13 0     0 0   my $class = shift;
14 0           my @specs = $class->SUPER::create_option_specs();
15             return (
16 0           @specs,
17             'output-dir|o=s',
18             );
19             }
20              
21             sub convert_options {
22 0     0 0   my ($class, $opts, $argv) = @_;
23              
24             # required option
25 0 0         pod2usage(1) unless $opts->{'output-dir'};
26              
27 0           my %args = $class->SUPER::convert_options($opts, $argv);
28 0           $args{output_dir} = $opts->{'output-dir'};
29 0           return %args;
30             }
31              
32             sub create_storage {
33 0     0 0   my $self = shift;
34 0           return AnyPAN::Storage::Directory->new(
35             path => $self->output_dir,
36             );
37             }
38              
39             1;
40             __END__