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 7     7   3354 use Moo 2;
  7         117  
  7         38  
3              
4             # ABSTRACT: Base class for table decoders
5             our $VERSION = '0.011'; # VERSION
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   43 my ($name, $modules, $req_versions)= @_;
15 6         48 require Module::Runtime;
16 6         21 for my $mod (@$modules) {
17 7 100       92503 my ($pkg, $ver)= ref $mod eq 'ARRAY'? @$mod : ( $mod, 0 );
18 7 100       16 return $pkg if eval { Module::Runtime::use_module($pkg, $ver) };
  7         35  
19             }
20 1         203 require Carp;
21 1 50       268 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__