File Coverage

blib/lib/Data/TableReader/Decoder/XLS.pm
Criterion Covered Total %
statement 14 15 93.3
branch 2 4 50.0
condition 3 6 50.0
subroutine 4 4 100.0
pod 1 1 100.0
total 24 30 80.0


line stmt bran cond sub pod time code
1             package Data::TableReader::Decoder::XLS;
2 1     1   917 use Moo 2;
  1         19  
  1         9  
3 1     1   573 use Carp;
  1         1  
  1         349  
4             extends 'Data::TableReader::Decoder::Spreadsheet';
5              
6             our @xls_probe_modules= ( [ 'Spreadsheet::ParseExcel', '0.66' ] );
7             our $default_xls_module;
8             sub default_xls_module {
9 2   66 2 1 260247 $default_xls_module ||=
10             Data::TableReader::Decoder::_first_sufficient_module('XLS parser', \@xls_probe_modules);
11             }
12              
13             # ABSTRACT: Access sheets/rows of a Microsoft Excel '97 workbook
14             our $VERSION = '0.021'; # VERSION
15              
16              
17             sub _build_workbook {
18 1     1   8 my $self= shift;
19            
20 1         2 my $wbook;
21 1         4 my $f= $self->file_handle;
22 1 50 33     14 if (ref $f and ref($f)->can('worksheets')) {
23 0         0 $wbook= $f;
24             } else {
25 1         4 $wbook= $self->default_xls_module->new->parse($f, $self->xls_formatter);
26             }
27 1 50       27719 defined $wbook or croak "Can't parse file '".$self->file_name."'";
28 1         10 return $wbook;
29             }
30              
31             1;
32              
33             __END__