File Coverage

blib/lib/Data/TableReader/Decoder.pm
Criterion Covered Total %
statement 11 11 100.0
branch 5 6 83.3
condition n/a
subroutine 2 2 100.0
pod n/a
total 18 19 94.7


line stmt bran cond sub pod time code
1             package Data::TableReader::Decoder;
2             $Data::TableReader::Decoder::VERSION = '0.010';
3 7     7   4052 use Moo 2;
  7         144  
  7         85  
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   25 my ($name, $modules, $req_versions)= @_;
15 6         38 require Module::Runtime;
16 6         22 for my $mod (@$modules) {
17 7 100       91927 my ($pkg, $ver)= ref $mod eq 'ARRAY'? @$mod : ( $mod, 0 );
18 7 100       44 return $pkg if eval { Module::Runtime::use_module($pkg, $ver) };
  7         54  
19             }
20 1         197 require Carp;
21 1 50       243 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__