Branch Coverage

blib/lib/Data/TableReader.pm
Criterion Covered Total %
branch 132 244 54.1


line true false branch
34 1 12 if ref $i and ref $i eq 'Spreadsheet::ParseExcel::Worksheet'
35 4 8 if ref $i and ref $i eq 'GLOB' || ref($i)->can('read')
36 0 8 unless open my $fh, '<', $i
47 1 12 if (not $decoder_arg) { }
4 8 elsif (not $decoder_ref) { }
8 0 elsif ($decoder_ref eq 'HASH' or $decoder_ref eq 'ARRAY') { }
0 0 elsif ($decoder_ref->can('iterator')) { }
55 0 8 $decoder_ref eq 'ARRAY' ? :
59 0 8 unless ($class)
61 0 0 unless $input_class
72 13 0 unless $class =~ /::/
74 0 13 unless &require_module($class)
76 4 9 $self->input eq ($self->_file_handle || '') ? :
87 0 13 unless defined $list and ref $list eq 'ARRAY'
90 5 29 if (not ref $_) { }
29 0 elsif (ref $_ eq 'HASH') { }
95 0 29 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 97 if $dest->can('is_' . $level)->($dest)
140 10 0 ref($dest)->can('info') ? :
2 10 ref $dest eq 'ARRAY' ? :
1 12 !$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 8 if $self->_has_table_found
231 8 0 if ($self->_find_table($self->decoder->iterator, \%loc))
248 12 0 if ($stash->{'col_map'}) { }
253 18 39 unless $col_map->[$i]
254 10 29 if ($col_map->[$i]->array) { }
269 0 0 if $stash->{'croak_on_fail'}
280 0 13 unless (defined $header_at)
281 0 0 unless ($self->static_field_order)
292 13 0 ref $header_at ? :
296 0 13 if ($start > 1)
305 1 21 unless ($vals)
309 5 16 if ($row_accum > 1) { }
319 0 21 $self->static_field_order ? :
324 12 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 ? :
26 5 $a->required ? :
364 30 12 if (@found == 1) { }
1 11 elsif (@found > 1) { }
9 2 elsif ($f->required) { }
365 0 30 if ($col_map{$found[0]})
374 1 0 if ($f->array) { }
392 0 12 unless (keys %col_map)
398 2 10 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 7 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 12 unless ($data_iter)
506 0 14 if ($self->record_class eq 'ARRAY') { }
510 0 0 defined $src ? :
516 0 14 unless 'HASH' eq $self->record_class
524 35 2 if (not ref $row_slice[$_]) { }
526 35 0 if $field->trim
528 4 31 if $field->type
541 10 0 if $field->trim
543 0 10 if $field->type
551 13 35 unless my $row = !$eof && &$data_iter(\@row_slice)
563 14 79 if not defined $row->[$_] && length $row->[$_]
565 2 33 if ($n_blank == @$row) { }
2 31 elsif ($first_blank) { }
569 0 2 unless ($self->_handle_blank_row($first_blank, $data_iter->position))
576 18 15 if (@type_check)
577 6 12 if (my(@failed) = map(&$_($row), @type_check))
578 3 2 unless $self->_handle_validation_fail(\@failed, $row, $data_iter->position . ': ')
585 0 29 unless @field_names
590 0 29 $class ? :
602 6 12 defined $e ? :
606 0 0 defined $e ? :
608 0 0 $t->can('validate') ? :
4 0 ref $t eq 'CODE' ? :
614 0 2 if ref $act eq 'CODE'
616 2 0 if ($act eq 'next')
620 0 0 if ($act eq 'last')
624 0 0 if ($act eq 'die')
635 1 5 if ref $act eq 'CODE'
638 3 3 if ($act eq 'next')
639 3 0 if $errors
642 2 1 if ($act eq 'use')
643 1 1 if $errors
646 1 0 if ($act eq 'die')