Branch Coverage

blib/lib/Text/RecordParser.pm
Criterion Covered Total %
branch 168 180 93.3


line true false branch
165 22 33 scalar @_ == 1 ? :
3 55 defined $_[0] && UNIVERSAL::isa($_[0], 'HASH') ? :
172 1 57 if (my $fs = $$args{'fs'})
177 1 57 if (my $rs = $$args{'rs'})
188 466 56 unless defined $$args{$arg}
190 37 19 if ($arg =~ / \A (filename|fh|data) \Z /msx)
197 1 57 if ($data_handles > 1)
231 1 41 if (ref $_[0] eq 'ARRAY' and not @{$_[0];}) { }
40 1 elsif (@_) { }
242 0 183 unless $fields[$i]
274 34 2 if (my(@columns) = $self->fetchrow_array) { }
275 2 32 if (my $filter = $self->header_filter)
307 3 90 if (my $arg = shift())
308 1 2 if (ref $arg ne 'Regexp')
315 8 84 defined $$self{'comment'} ? :
343 9 1 if (@_) { }
346 1 8 if (UNIVERSAL::isa($arg, 'SCALAR')) { }
1 7 elsif (UNIVERSAL::isa($arg, 'ARRAY')) { }
1 6 elsif (UNIVERSAL::isa($arg, 'GLOB')) { }
2 4 elsif (not ref $arg and @_) { }
367 8 1 if ($data) { }
394 1 5 unless my(@fields) = @_
396 1 3 unless my $record = $self->fetchrow_hashref
400 3 1 if ($allowed{$field}) { }
414 1 1 scalar @data == 1 ? :
432 1 90 unless my $fh = $self->fh
440 10 91 unless defined($line = <$fh>)
442 4 87 if $comment and $line =~ /$comment/
444 80 7 if $line
448 2 78 if $separator eq $PIPE
449 391 0 if defined $_
3 77 ref $separator eq 'Regexp' ? :
455 0 80 unless (@fields)
459 4 76 if (my $filter = $self->field_filter)
463 7 73 if ($self->trim)
464 29 0 if defined $_
468 4 3 unless $position =~ /^\d+$/
472 70 10 wantarray ? :
493 0 38 unless my(@fields) = $self->field_list
494 5 33 unless my(@row) = $self->fetchrow_array
499 0 156 unless defined $row[$i]
501 2 154 if (my(@aliases) = $self->get_field_aliases($field))
538 1 3 unless my $row = $self->fetchrow_hashref
539 0 3 unless my(@fields) = $self->field_list
571 2 1 @_ % 2 == 0 ? :
1 3 defined $_[0] && ref $_[0] eq 'HASH' ? :
575 1 3 ref $args{'Columns'} eq 'HASH' ? :
612 3 2 unless ($field_ok)
613 1 2 unless (exists $$record{$key_field})
642 13 135 if (defined $arg)
643 1 12 unless (UNIVERSAL::isa($arg, 'GLOB'))
647 3 9 if (defined $$self{'fh'})
648 1 2 unless close $$self{'fh'}
655 73 73 unless (defined $$self{'fh'})
656 33 40 if (my $file = $self->filename)
657 1 32 unless open my $fh, '<', $file
738 6 124 if (@_)
741 1 5 unless ($position =~ /\S+/)
745 1 4 if (ref $callback ne 'CODE')
773 6 83 if (defined $filter)
774 1 5 if ($filter eq $EMPTY_STR) { }
4 1 elsif (ref $filter eq 'CODE') { }
805 12 53 unless ($$self{'fields_bound'})
809 63 0 if (ref $$self{'field_pos_ordered'} eq 'ARRAY') { }
833 3 3 if (ref $$self{'field_pos'} eq 'HASH') { }
862 18 86 if (@_)
866 36 68 unless ($$self{'field_separator'})
868 22 14 if (my $filename = $self->filename)
869 21 1 if ($filename =~ /\.(csv|txt|dat)$/) { }
0 1 elsif ($filename =~ /\.tab$/) { }
877 21 15 if ($guess)
902 42 118 if (my $filename = shift())
903 1 41 if (-d $filename) { }
40 1 elsif (-f _ and -r _) { }
907 2 38 if (my $fh = $self->fh)
908 1 1 unless (close $fh)
945 0 167 unless my $field_name = shift()
947 160 7 unless ($$self{'field_alias'})
951 4 3 unless $$self{'field_alias'}{$field_name}
973 6 37 if (defined $filter)
974 1 5 if ($filter eq $EMPTY_STR) { }
4 1 elsif (ref $filter eq 'CODE') { }
980 2 2 if (my(%field_pos) = $self->field_positions)
1026 7 94 if (@_)
1052 1 0 ref $_[0] eq 'HASH' ? :
1057 1 1 if (ref $aliases ne 'ARRAY')
1061 1 1 unless ($is_field{$field_name})
1064 0 1 unless $field_name
1091 6 83 if (defined $arg)
1092 5 1 $arg ? :