Condition Coverage

blib/lib/Text/CSV_PP.pm
Criterion Covered Total %
condition 671 805 83.2


and 3 conditions

line !l l&&!r l&&r condition
234 3563 2 2 defined $quo and length $quo
237 2 3323 242 defined $quo and $quo =~ /^[ \t]/
238 3 3032 290 defined $esc and $esc =~ /^[ \t]/
248 11729 380 35 defined $sep and length $sep
250 12113 13 18 defined $quo and length $quo
288 88 692 8 @_ > 0 and ref $_[0] ne 'HASH'
311 1 6 1842 /^[a-z]/ and exists $def_attr{$_}
313 21 1694 127 defined $attr{$_} and /_char$/
331 747 4 21 $quote_aliased and defined $attr{'quote_char'}
348 483 248 6 defined $self->{'callbacks'} and ref $self->{'callbacks'} ne 'HASH'
354 727 2 8 defined $\ and not exists $attr{'eol'}
465 6 6 6 defined $quote && length $quote
510 4 295 21 defined $sep && length $sep
736 26 4 8 @_ == 1 && ref $_[0] eq 'HASH'
742 4 10 21 $cbk =~ /^[\w.]+$/ and ref $cb->{$cbk} eq 'CODE'
769 66 4 1592 $self and ref $self
70 1 1591 $self and ref $self and UNIVERSAL::isa($self, 'Text::CSV_PP')
5 102 1489 $self and ref $self and UNIVERSAL::isa($self, 'Text::CSV_PP') and exists $self->{'_ERROR_DIAG'}
778 5 1261 223 $diag[0] and $self->{'callbacks'}
1261 220 3 $diag[0] and $self->{'callbacks'} and $self->{'callbacks'}{'error'}
784 8 226 12 $diag[0] and $diag[0] != 2012
788 3 1 8 $self and ref $self
794 6 0 2 $self->{'diag_verbose'} and $self->{'_ERROR_INPUT'}
803 1 6 0 @c >= 11 and $c[10]
6 0 0 @c >= 11 and $c[10] and ref $c[10] eq 'HASH'
807 0 0 0 exists $hints->{'autodie'} and $hints->{'autodie'}
0 0 0 exists $hints->{'guard Fatal'} and not exists $hints->{'no Fatal'}
881 1 1 1397 @fields > 0 && $self->__combine(\$str, \@fields, 0)
898 6 201 1722 defined $str and $self->__parse($fields, $fflags, $str, 0)
915 280 200 136 @columns == 1 and not defined $columns[0]
917 280 8 192 @columns == 1 and ref $columns[0] eq 'ARRAY'
924 473 1 1 $self->{'_BOUND_COLUMNS'} and @columns != @{$self->{'_BOUND_COLUMNS'};}
951 295 0 0 defined $args{'munge'} and not defined $args{'munge_column_names'}
972 2 0 288 defined $hdr and $hdr ne ''
1056 11 7 5 @refs == 1 and not defined $refs[0]
1058 15 2 1 $self->{'_COLUMN_NAMES'} and @refs != @{$self->{'_COLUMN_NAMES'};}
1079 2 1 2 @$fr == 1 and !defined($fr->[0]) || $fr->[0] eq ''
1102 0 12 1 @f == 1 && !defined($f[0])
1121 1 19 38 defined $spec and $spec =~ /^ \s* \x23 ? \s* # optional leading # ( row | col | cell ) \s* = ( $qc # for row and col | $qd , $qd (?: - $qs , $qs)? # for cell (ranges) (?: ; $qd , $qd (?: - $qs , $qs)? )* # and cell (range) lists ) \s* $/xi
1143 3 27 2 $brr ne '*' and $brr == 0 || $brr < $tlr
2 26 2 $brc ne '*' and $brc == 0 || $brc < $tlc
1162 6 39 15 $brr ne '*' and $r > $brr
1172 6 17 10 $max_row ne '*' and $r == $max_row
1196 28 33 3 $r > $#r and $eod
1218 262 0 4 @_ == 1 && ref $_[0] eq 'HASH'
1231 242 21 0 exists $attr{'out'} && !$attr{'out'}
1235 0 240 23 $in and $out
240 20 3 $in and $out and not ref $in
260 2 1 $in and $out and not ref $in and not ref $out
1240 8 2 12 ref $out and 'SCALAR' ne ref $out
7 0 2 ref $out and 'SCALAR' eq ref $out
7 0 2 ref $out and 'SCALAR' eq ref $out and defined $$out
0 1 1 ref $out and 'SCALAR' eq ref $out and defined $$out and $$out eq 'skip'
1270 14 2 0 not ref $in and $] < 5.008005
1313 770 1 6 exists $attr{$f} and not exists $attr{$t}
1318 0 2 0 defined $_[1][0] and $_[1][0] ne ''
1323 243 13 3 defined $fltr and not ref $fltr
256 0 3 defined $fltr and not ref $fltr and exists $fltr{$fltr}
1361 1 257 9 @_ and ref $_[0] eq 'Text::CSV_PP' || ref $_[0] eq 'Text::CSV'
1373 239 1 19 $c->{'out'} and not $c->{'sink'}
1436 4 3 5 ref $key eq 'ARRAY' and @$key > 1
1442 2 1 2 ref $val eq 'ARRAY' and @$val > 0
1445 208 11 5 $c->{'fltr'} and grep /\D/, keys %{$$c{'fltr'};}
1469 182 0 6 $c->{'kh'} and $hdrs
1528 77 0 145 @row1 and not $c->{'hd_c'}
77 141 4 @row1 and not $c->{'hd_c'} and not ref $hdrs
1534 0 204 18 $ref and $c->{'cbai'} || $c->{'cboi'}
1574 484 189 5 defined $self->{'sep'} and $self->{'sep'} ne ''
1584 4 0 674 defined $quote_char and length $quote_char
1590 673 1 4 defined $self->{'quote'} and $self->{'quote'} ne ''
1600 6 2 670 defined $escape_char and length $escape_char
1612 578 56 40 $eol_len == 1 and $eol eq "\r"
1637 239 0 9 defined $cb->{'after_parse'} and ref $cb->{'after_parse'} eq 'CODE'
1640 247 0 1 defined $cb->{'before_print'} and ref $cb->{'before_print'} eq 'CODE'
1671 14 0 75 $bound and ref $bound eq 'ARRAY'
1685 27426 0 54 $ctx->{'sep_len'} and $ctx->{'sep_len'} > 1
27426 40 14 $ctx->{'sep_len'} and $ctx->{'sep_len'} > 1 and _is_valid_utf8($ctx->{'sep'})
1688 27452 0 28 $ctx->{'quo_len'} and $ctx->{'quo_len'} > 1
27452 28 0 $ctx->{'quo_len'} and $ctx->{'quo_len'} > 1 and _is_valid_utf8($ctx->{'quo'})
1777 0 0 1 $cache->{'sep_len'} and $cache->{'sep_len'} > 1
1781 0 0 1 $cache->{'quo_len'} and $cache->{'quo_len'} > 1
1820 36 0 125 $cb and ref $cb eq 'CODE'
1824 61 0 64 ref $res[0] eq 'SCALAR' and ${$res[0];} eq 'skip'
1843 0 2 21668 $esc ne '' and $esc ne "\000"
1853 21664 1 5 $n < 0 and $ctx->{'is_bound'}
1858 21668 0 2 $ctx->{'keep_meta_info'} >= 10 && @{[] unless $self->{'_FFLAGS'};} >= $n
1888 53795 6 10 substr($value, 0, 1) eq '=' and $ctx->{'formula'}
1898 1393 3 2 $check_meta and $self->is_quoted($i)
1907 52391 7 5 $check_meta and $self->is_quoted($i)
1909 5636 3 46764 not $must_be_quoted and $quot ne ''
1916 0 762 45045 $sep ne '' and $sep ne "\000"
762 44720 325 $sep ne '' and $sep ne "\000" and $value =~ /\Q$sep\E/
0 2 45480 $esc ne '' and $esc ne "\000"
2 45160 320 $esc ne '' and $esc ne "\000" and $value =~ /\Q$esc\E/
6 24832 20324 $ctx->{'quote_binary'} and $value =~ /[\x00-\x1f\x7f-\xa0]/
24 23579 1235 $ctx->{'quote_space'} and $value =~ /[\x09\x20]/
1919 52018 378 7 not $ctx->{'binary'} and $value =~ /[^\x09\x20-\x7E]/
1959 5 0 1 ref $column_names eq 'ARRAY' and @$column_names >= $i - 1
2008 325 3025 5 $state and ($ctx->{'has_hooks'} || 0) & 2
2023 2081 0 168 $ctx->{'has_ahead'} and defined $self->{'_AHEAD'}
2054 0 2159 90 defined $ctx->{'tmp'} and $ctx->{'used'} < $ctx->{'size'}
2159 60 30 defined $ctx->{'tmp'} and $ctx->{'used'} < $ctx->{'size'} and $ctx->{'has_ahead'}
2075 577 3590 2 $result and $ctx->{'types'}
2077 2 0 8 $i <= $len and $i <= $ctx->{'types_len'}
2097 22 4124 30 not $ctx->{'utf8'} and $ctx->{'sep_len'}
2098 22 4136 18 not $ctx->{'utf8'} and $ctx->{'quo_len'}
2099 22 3140 1014 not $ctx->{'utf8'} and $ctx->{'eol_len'}
2116 22012 51304 623 not $waitingForField and $c eq ''
73316 321 302 not $waitingForField and $c eq '' and $hit ne ''
51625 8 294 not $waitingForField and $c eq '' and $hit ne '' and $ctx->{'useIO'}
8 147 147 not $waitingForField and $c eq '' and $hit ne '' and $ctx->{'useIO'} and not $ctx->{'useIO'} & 16
2122 3892 43182 26718 $seenSomething and $hit eq ''
47074 26366 352 $seenSomething and $hit eq '' and $c eq ''
2140 0 28356 45080 defined $hit and $hit ne ''
2151 5 0 74080 defined $c and defined $sep
5 62789 11291 defined $c and defined $sep and $c eq $sep
5 0 62789 defined $c and defined $quot
5 139 62650 defined $c and defined $quot and $quot ne "\000"
139 39786 22864 defined $c and defined $quot and $quot ne "\000" and $c eq $quot
5 0 39925 defined $c and defined $esc
5 139 39786 defined $c and defined $esc and $esc ne "\000"
139 35131 4655 defined $c and defined $esc and $esc ne "\000" and $c eq $esc
5 35270 0 defined $c and $c eq "\n" || $c eq '' || defined $eol && $c eq $eol && $eol ne "\r"
5 31951 965 defined $c and $c eq "\r"
31956 3 962 defined $c and $c eq "\r" and not $ctx->{'verbatim'}
2164 1157 0 8 $ctx->{'keep_meta_info'} and $fflags
2197 0 1 0 defined $esc && $c2 eq $esc
89 0 1 $ctx->{'allow_loose_quotes'} and not defined $esc && $c2 eq $esc
2212 0 0 10593 defined $c2 and defined $sep
0 1576 9017 defined $c2 and defined $sep and $c2 eq $sep
2220 0 1411 165 defined $c2 and $c2 eq "\n" || defined $eol && $c2 eq $eol
2227 0 21 1254 defined $esc and $c eq $esc
2229 0 1203 51 defined $c2 and $c2 eq '0'
2235 0 0 1203 defined $c2 and defined $quot
0 126 1077 defined $c2 and defined $quot and $c2 eq $quot
2244 121 0 5 $ctx->{'allow_loose_escapes'} and defined $c2
121 1 4 $ctx->{'allow_loose_escapes'} and defined $c2 and $c2 ne "\r"
2252 0 55 88 defined $c2 and $c2 eq "\r"
2261 5 9 74 defined $c3 and $c3 eq "\n"
2268 13 0 1 $ctx->{'useIO'} and not $ctx->{'eol_len'}
13 0 1 $ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c3 =~ /[^\x09\x20-\x7E]/
2283 43 2 10 $ctx->{'allow_loose_quotes'} and not $quoesc
2325 0 2 0 defined $quot and $c2 eq $quot
0 0 2 defined $sep and $c2 eq $sep
0 0 0 defined $esc and $c2 eq $esc
2351 0 2196 2411 defined $quot and $c2 eq $quot
0 2193 3 defined $sep and $c2 eq $sep
0 28 2165 defined $esc and $c2 eq $esc
2397 115 0 6 $ctx->{'keep_meta_info'} and $fflags
2420 6 2 2 $ctx->{'eol'} eq $c and $ctx->{'useIO'}
2425 1109 336 10 not $ctx->{'recno'} and $ctx->{'fld_idx'} == 1
1445 3 7 not $ctx->{'recno'} and $ctx->{'fld_idx'} == 1 and $ctx->{'useIO'}
3 3 4 not $ctx->{'recno'} and $ctx->{'fld_idx'} == 1 and $ctx->{'useIO'} and $hit =~ /^sep=(.{1,16})$/i
2465 5 0 4 $ctx->{'useIO'} and not $ctx->{'eol_len'}
5 3 1 $ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c2 =~ /[^\x09\x20-\x7E]/
2501 5 10 108 defined $c2 and $c2 eq "\n"
2508 5 0 10 $ctx->{'useIO'} and not $ctx->{'eol_len'}
5 6 4 $ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c2 =~ /[^\x09\x20-\x7E]/
2526 31215 744 0 $ctx->{'eolx'} and $c eq $eol
2532 209 113 231 $ctx->{'allow_whitespace'} and $self->__is_whitespace($ctx, $c)
2562 40836 7732 12 $ctx->{'useIO'} and $ctx->{'verbatim'}
7732 9 3 $ctx->{'useIO'} and $ctx->{'verbatim'} and $ctx->{'used'} == $ctx->{'size'}
2589 29 0 3 $ctx->{'keep_meta_info'} and $fflags
2611 2081 504 2091 defined $ctx->{'tmp'} and $ctx->{'used'} <= 0
2721 0 724 0 (!defined($ctx->{'sep'}) || $c ne $ctx->{'sep'}) && (!defined($ctx->{'quo'}) || $c ne $ctx->{'quo'}) && (!defined($ctx->{'escape_char'}) || $c ne $ctx->{'escape_char'}) && ($c eq ' ' || $c eq "\t")
2729 20338 0 62 $ctx->{'formula'} and $$v_ref
20338 50 12 $ctx->{'formula'} and $$v_ref and substr($$v_ref, 0, 1) eq '='
2734 19569 799 20 !defined($$v_ref) || $$v_ref eq '' and $ctx->{'empty_is_undef'} || !($flag & 1) && $ctx->{'blank_is_undef'}
2740 14600 4012 1756 $ctx->{'allow_whitespace'} and not $flag & 1
2743 16474 0 3894 $flag & 2 and $ctx->{'decode_utf8'}
0 1688 2206 $flag & 2 and $ctx->{'decode_utf8'} and $ctx->{'utf8'} || _is_valid_utf8($$v_ref)
2750 20292 0 96 $ctx->{'keep_meta_info'} and $fflags
2786 36 502 12 $n++ >= $tail and $tail
2799 419 36 32 defined $len and $n >= $len
455 20 12 defined $len and $n >= $len and $offset >= 0
2802 240 16 8 defined $len and $n > $len
2841 2 6 0 $self and (&Scalar::Util::reftype($self) || '') eq 'HASH' || ref($self) =~ /^Text::CSV/

or 2 conditions

line l !l condition
289 692 88 shift() || {}
587 7 1 $self ||= 'Text::CSV_PP'
1079 0 2 $self->{'_FFLAGS'}[0] ||= 16
1192 28 27 $_ ||= 0
1222 44 221 delete $attr{'enc'} || delete $attr{'encoding'} || ''
1233 19 1 $out ||= \*STDOUT
1383 1 1 $hdrs ||= [map({$_ unless $hdr{$_};} keys %$row)]
1426 0 141 $hdrs ||= \@hdr
1431 3 3 $hdrs ||= 'auto'
1437 7 12 $hdrs ||= 'auto'
1445 2 3 $hdrs ||= 'auto'
2008 5 3025 $ctx->{'has_hooks'} || 0
2770 20 244 $offset ||= 0
2790 120 430 $ctx->{'has_hooks'} || 0

or 3 conditions

line l !l&&r !l&&!r condition
287 0 788 1 ref $proto || $proto
612 1 1 9 not defined $v or $v eq ''
680 1 1 7 not defined $v or $v eq ''
691 1 1 6 not defined $v or $v eq ''
807 0 0 0 exists $hints->{'autodie'} and $hints->{'autodie'} or exists $hints->{'guard Fatal'} and not exists $hints->{'no Fatal'}
854 1 0 25 $_[1] =~ /\D/ or $_[1] < 0
1 1 24 $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{'_FFLAGS'};}
861 1 0 9 $_[1] =~ /\D/ or $_[1] < 0
1 1 8 $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{'_FFLAGS'};}
868 1 1 11 $idx < 0 or not ref $self->{'_FFLAGS'}
1079 0 2 1 !defined($fr->[0]) || $fr->[0] eq ''
1100 0 11 0 $\ || $/
1143 2 2 32 $tlr == 0 or $tlc == 0
0 2 27 $brr == 0 || $brr < $tlr
4 2 30 $tlr == 0 or $tlc == 0 or $brr ne '*' and $brr == 0 || $brr < $tlr
0 2 26 $brc == 0 || $brc < $tlc
2 2 28 $tlr == 0 or $tlc == 0 or $brr ne '*' and $brr == 0 || $brr < $tlr or $brc ne '*' and $brc == 0 || $brc < $tlc
1151 2 17 9 $brr eq '*' or $brr > $max_row
1162 17 15 45 $r < $tlr or $brr ne '*' and $r > $brr
1163 33 3 9 not defined $lc or $tlc < $lc
1183 9 14 2 $to ||= $from
1186 2 1 22 $from <= 0 or $to < $from
1196 3 17 44 $r > $#r and $eod or $r[$r]
1205 27 99 279 $_ > $#r && $eod || $r[$_]
1229 260 3 3 delete $attr{'in'} || delete $attr{'file'}
1231 21 1 241 delete $attr{'out'} || delete $attr{'file'}
1233 3 17 243 ref $in eq 'CODE' or ref $in eq 'ARRAY'
1240 12 1 9 ref $out and 'SCALAR' ne ref $out or 'GLOB' eq ref \$out
1260 3 16 242 ref $in eq 'CODE' or ref $in eq 'ARRAY'
14 2 206 ref $in or 'GLOB' eq ref \$in
1281 259 0 0 $fh or $sink
1289 2 7 248 delete $attr{'keep_headers'} || delete $attr{'keep_column_names'} || delete $attr{'kh'}
1294 1 1 248 delete $attr{'callbacks'}{'after_in'} || delete $attr{'after_in'} || delete $attr{'callbacks'}{'after_parse'} || delete $attr{'after_parse'}
1296 2 2 255 delete $attr{'callbacks'}{'before_out'} || delete $attr{'before_out'}
1298 4 11 244 delete $attr{'callbacks'}{'on_in'} || delete $attr{'on_in'}
1301 1 3 255 delete $attr{'sep_set'} || delete $attr{'seps'}
1303 42 92 125 delete $attr{'detect_bom'} || delete $attr{'bom'}
1305 6 1 252 delete $attr{'munge'} || delete $attr{'munge_column_names'}
1332 11 248 0 delete $attr{'csv'} || 'Text::CSV_PP'->new(\%attr)
1361 0 9 257 ref $_[0] eq 'Text::CSV_PP' || ref $_[0] eq 'Text::CSV'
1403 1 5 1 ref $hdrs or $hdrs eq 'auto'
1418 4 134 102 defined $c->{'hd_s'} or defined $c->{'hd_b'}
138 5 97 defined $c->{'hd_s'} or defined $c->{'hd_b'} or defined $c->{'hd_m'}
139 2 95 defined $c->{'hd_s'} or defined $c->{'hd_b'} or defined $c->{'hd_m'} or defined $c->{'hd_c'}
1436 14 5 7 not ref $key or ref $key eq 'ARRAY' and @$key > 1
1442 3 2 3 not ref $val or ref $val eq 'ARRAY' and @$val > 0
1457 0 3 0 $hdr{$_} || $_
1461 0 3 0 $hdr{$_} || $_
1467 0 3 0 $hdr{$_} || $_
1534 11 11 200 $c->{'cbai'} || $c->{'cboi'}
1682 8 500 930 $ctx->{'verbatim'} || $ctx->{'eol_len'} >= 2
1840 0 1 21669 not defined $quot or $quot eq "\000"
1845 21480 187 0 $self->{'_re_comb_escape'}{$quot}{$esc} ||= qr/(\Q$quot\E|\Q$esc\E)/
1847 0 1 0 $self->{'_re_comb_escape'}{$quot}{$esc} ||= qr/(\Q$esc\E)/
1898 4 2 1396 $ctx->{'quote_empty'} or $check_meta and $self->is_quoted($i)
1916 957 325 45482 $value =~ /\Q$quot\E/ or $sep ne '' and $sep ne "\000" and $value =~ /\Q$sep\E/
325 320 45162 $value =~ /\Q$quot\E/ or $sep ne '' and $sep ne "\000" and $value =~ /\Q$sep\E/ or $esc ne '' and $esc ne "\000" and $value =~ /\Q$esc\E/
320 20324 24838 $value =~ /\Q$quot\E/ or $sep ne '' and $sep ne "\000" and $value =~ /\Q$sep\E/ or $esc ne '' and $esc ne "\000" and $value =~ /\Q$esc\E/ or $ctx->{'quote_binary'} and $value =~ /[\x00-\x1f\x7f-\xa0]/
20324 1240 23598 $value =~ /\Q$quot\E/ or $sep ne '' and $sep ne "\000" and $value =~ /\Q$sep\E/ or $esc ne '' and $esc ne "\000" and $value =~ /\Q$esc\E/ or $ctx->{'quote_binary'} and $value =~ /[\x00-\x1f\x7f-\xa0]/ or $ctx->{'quote_space'} and $value =~ /[\x09\x20]/
2011 3030 2 323 $state || !$last_error
2017 416 406 3350 $ctx->{'eolx'} or $ctx->{'eol_is_cr'}
2044 9 6 0 $ctx->{'strict_n'} ||= $ctx->{'fld_idx'}
2151 1954 0 33316 $c eq "\n" || $c eq '' || defined $eol && $c eq $eol && $eol ne "\r"
2155 29 24 1112 $ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}
2220 160 153 1263 $c2 eq "\n" || defined $eol && $c2 eq $eol
2325 0 2 0 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep
2 0 0 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep or defined $esc and $c2 eq $esc
0 0 0 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep or defined $esc and $c2 eq $esc or $ctx->{'allow_loose_escapes'}
2351 2411 3 2193 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep
3 2165 28 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep or defined $esc and $c2 eq $esc
2165 0 28 defined $quot and $c2 eq $quot or defined $sep and $c2 eq $sep or defined $esc and $c2 eq $esc or $ctx->{'allow_loose_escapes'}
2389 4 4 113 $ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}
2543 0 3249 26146 not defined $c or $c =~ /[^\x09\x20-\x7E]/
2545 3237 10 2 $ctx->{'binary'} or $ctx->{'utf8'}
2552 5 402 1604 not defined $c or $c =~ /[^\x09\x20-\x7E]/
2554 398 0 9 $ctx->{'binary'} or $ctx->{'utf8'}
2567 32 0 284 $seenSomething or not $ctx->{'useIO'}
2581 5 4 23 $ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}
2734 0 819 19569 !defined($$v_ref) || $$v_ref eq ''
16 4 799 $ctx->{'empty_is_undef'} || !($flag & 1) && $ctx->{'blank_is_undef'}
2743 76 2190 1628 $ctx->{'utf8'} || _is_valid_utf8($$v_ref)
2841 4 0 2 (&Scalar::Util::reftype($self) || '') eq 'HASH' || ref($self) =~ /^Text::CSV/