Branch Coverage

blib/lib/Data/TableReader.pm
Criterion Covered Total %
branch 133 244 54.5


line true false branch
34 1 13 if ref $i and ref $i eq 'Spreadsheet::ParseExcel::Worksheet'
35 4 9 if ref $i and ref $i eq 'GLOB' || ref($i)->can('read')
36 0 9 unless open my $fh, '<', $i
47 1 13 if (not $decoder_arg) { }
4 9 elsif (not $decoder_ref) { }
9 0 elsif ($decoder_ref eq 'HASH' or $decoder_ref eq 'ARRAY') { }
0 0 elsif ($decoder_ref->can('iterator')) { }
55 0 9 $decoder_ref eq 'ARRAY' ? :
59 0 9 unless ($class)
61 0 0 unless $input_class
72 14 0 unless $class =~ /::/
74 0 14 unless &require_module($class)
76 4 10 $self->input eq ($self->_file_handle || '') ? :
87 0 14 unless defined $list and ref $list eq 'ARRAY'
90 5 33 if (not ref $_) { }
33 0 elsif (ref $_ eq 'HASH') { }
95 0 33 if defined $args{'isa'} and not defined $args{'type'}
125 2 0 unless $level eq 'warn' or $level eq 'error'
126 0 0 if @args
131 10 1 unless $level eq 'warn' or $level eq 'error'
132 1 0 if @args
137 19 2 @args ? :
21 103 if $dest->can('is_' . $level)->($dest)
140 11 0 ref($dest)->can('info') ? :
2 11 ref $dest eq 'ARRAY' ? :
1 13 !$dest ? :
149 1 0 if ref $input and ref($input)->can('get_cell')
151 0 0 if ref $input and ref($input)->can('worksheets')
156 0 0 unless (defined $magic)
159 0 0 if (seek $fh, 0, 1) { }
0 0 elsif ($fh->can('ungets')) { }
162 0 0 unless seek $fh, $fpos, 0
178 0 0 if $magic =~ /^PK(\x03\x04|\x05\x06|\x07\x08)/
179 0 0 if $magic =~ /^\xD0\xCF\x11\xE0/
185 0 0 unless (defined $filename)
187 0 0 if defined $input and !ref($input) || ref($input) =~ /path|file/i
189 0 0 if ($filename =~ /\.([^.]+)$/)
191 0 0 if $suffix eq 'HTM'
197 0 0 !defined($fpos) ? :
0 0 unless length $magic
201 0 0 if $magic =~ /^(\xEF\xBB\xBF|\xFF\xFE|\xFE\xFF)?<(!DOCTYPE )HTML/i
204 0 0 if $magic =~ /^(\xEF\xBB\xBF|\xFF\xFE|\xFE\xFF)?["']?[\w ]+["']?,/
205 0 0 if $magic =~ /^(\xEF\xBB\xBF|\xFF\xFE|\xFE\xFF)?["']?[\w ]+["']?\t/
209 0 0 if $comma_count > $eol_count and $comma_count > $tab_count
210 0 0 if $tab_count > $eol_count and $tab_count > $comma_count
213 0 0 if $probably_csv and $probably_csv > $probably_tsv
214 0 0 if $probably_tsv and $probably_tsv > $probably_csv
229 0 9 if $self->_has_table_found
231 9 0 if ($self->_find_table($self->decoder->iterator, \%loc))
248 13 0 if ($stash->{'col_map'}) { }
253 18 43 unless $col_map->[$i]
254 10 33 if ($col_map->[$i]->array) { }
269 0 0 if $stash->{'croak_on_fail'}
280 0 14 unless (defined $header_at)
281 0 0 unless ($self->static_field_order)
292 14 0 ref $header_at ? :
296 0 14 if ($start > 1)
305 1 22 unless ($vals)
309 5 17 if ($row_accum > 1) { }
319 0 22 $self->static_field_order ? :
324 13 9 if $stash->{'col_map'}
325 0 9 if $stash->{'fatal'}
336 0 0 if $header->[$i] =~ $fields->[$i]->header_regex
354 2 3 $b->required ? :
31 5 $a->required ? :
364 34 12 if (@found == 1) { }
1 11 elsif (@found > 1) { }
9 2 elsif ($f->required) { }
365 0 34 if ($col_map{$found[0]})
374 1 0 if ($f->array) { }
392 0 13 unless (keys %col_map)
398 2 11 if (@$follows_fields)
402 5 12 if ($col_map{$i}) { }
408 9 9 unless grep $following{$_}, $f->follows_list
409 7 2 if $val =~ $f->header_regex
411 7 5 if (@match == 1) { }
0 5 elsif (@match > 1) { }
412 0 7 if ($found{$match[0]} and not $match[0]->array)
434 0 3 if not $found{$_}
0 2 if (my(@unfound) = grep({$_->required if not $found{$_};} @$follows_fields))
437 0 0 @unfound > 1 ? :
445 5 8 if (@unclaimed)
448 0 5 if ref $act eq 'CODE'
449 5 0 if ($act eq 'use') { }
0 0 elsif ($act eq 'next') { }
0 0 elsif ($act eq 'die') { }
460 0 5 if $stash->{'fatal'}
466 18 69 if ref $_[0]
475 26 69 $colmap->{$_} ? :
489 2 13 unless ($data_iter)
506 0 15 if ($self->record_class eq 'ARRAY') { }
510 0 0 defined $src ? :
516 0 15 unless 'HASH' eq $self->record_class
524 39 2 if (not ref $row_slice[$_]) { }
526 38 1 if (my $t = $field->trim_coderef)
531 4 35 if $field->type
544 10 0 if (my $t = $field->trim_coderef)
549 0 10 if $field->type
558 14 36 unless my $row = !$eof && &$data_iter(\@row_slice)
569 14 83 if not defined $row->[$_] && length $row->[$_]
571 2 34 if ($n_blank == @$row) { }
2 32 elsif ($first_blank) { }
575 0 2 unless ($self->_handle_blank_row($first_blank, $data_iter->position))
582 18 16 if (@type_check)
583 6 12 if (my(@failed) = map(&$_($row), @type_check))
584 3 2 unless $self->_handle_validation_fail(\@failed, $row, $data_iter->position . ': ')
591 0 30 unless @field_names
596 0 30 $class ? :
608 6 12 defined $e ? :
612 0 0 defined $e ? :
614 0 0 $t->can('validate') ? :
4 0 ref $t eq 'CODE' ? :
620 0 2 if ref $act eq 'CODE'
622 2 0 if ($act eq 'next')
626 0 0 if ($act eq 'last')
630 0 0 if ($act eq 'die')
641 1 5 if ref $act eq 'CODE'
644 3 3 if ($act eq 'next')
645 3 0 if $errors
648 2 1 if ($act eq 'use')
649 1 1 if $errors
652 1 0 if ($act eq 'die')