File Coverage

blib/lib/Data/TableReader/Decoder.pm
Criterion Covered Total %
statement 8 10 80.0
branch 3 6 50.0
condition n/a
subroutine 2 2 100.0
pod n/a
total 13 18 72.2


line stmt bran cond sub pod time code
1             package Data::TableReader::Decoder;
2             $Data::TableReader::Decoder::VERSION = '0.009';
3 7     7   3137 use Moo 2;
  7         101  
  7         37  
4              
5             # ABSTRACT: Base class for table decoders
6              
7              
8             has file_name => ( is => 'ro', required => 1 );
9             has file_handle => ( is => 'ro', required => 1 );
10             has _log => ( is => 'ro', required => 1 );
11             *log= *_log; # back-compat, but deprecated since it doesn't match ->log on TableReader
12              
13             sub _first_sufficient_module {
14 6     6   18 my ($name, $modules, $req_versions)= @_;
15 6         32 require Module::Runtime;
16 6         18 for my $mod (@$modules) {
17 6 100       27 my ($pkg, $ver)= ref $mod eq 'ARRAY'? @$mod : ( $mod, 0 );
18 6 50       44 return $pkg if Module::Runtime::use_module($pkg, $ver);
19             }
20 0           require Carp;
21 0 0         Carp::croak "No $name available (or of sufficient version); install one of: "
22             .join(', ', map +(ref $_ eq 'ARRAY'? "$_->[0] >= $_->[1]" : $_), @$modules);
23             }
24              
25             1;
26              
27             __END__