Branch Coverage

blib/lib/Text/CSV_PP.pm
Criterion Covered Total %
branch 1251 1414 88.4


line true false branch
132 0 37 if ($] < 5.006) { }
0 37 elsif ($] < 5.008) { }
0 37 elsif (not defined &utf8::is_utf8) { }
133 0 0 unless $INC{'bytes.pm'}
150 0 37 if ($@)
152 0 0 if ($@) { }
167 0 0 unless length ref $r
170 0 0 length ref $$r ? :
0 0 exists $tmap{$t} ? :
264 12119 3568 unless $aw
267 3566 2 unless defined $quo and length $quo
270 242 3326 if defined $quo and $quo =~ /^[ \t]/
271 290 3036 if defined $esc and $esc =~ /^[ \t]/
281 12346 35 unless defined $sep and length $sep
283 12363 18 unless defined $quo and length $quo
291 2 12379 unless $sep ne ""
292 1 12378 if length $sep > 16
293 6 12372 if $sep =~ /[\r\n]/
295 12361 11 if (defined $quo)
296 228 12133 if $quo eq $sep
297 1 12132 if length $quo > 16
298 6 12126 if $quo =~ /[\r\n]/
300 12121 16 if (defined $esc)
301 168 11953 if $esc eq $sep
302 6 11947 if $esc =~ /[\r\n]/
304 11959 4 if (defined $eol)
305 1 11958 if length $eol > 16
320 1 954 unless my $class = ref $proto || $proto
321 8 946 if @_ > 0 and ref $_[0] ne "HASH"
324 2208 1 /^[a-zA-Z]\w+$/ ? :
325 21 2188 if exists $attr_alias{$k}
330 10 936 if (exists $attr{'sep'})
335 25 921 if (exists $attr{'quote'})
340 12 934 if exists $attr{'formula_handling'}
344 2165 6 if (/^[a-z]/ and exists $def_attr{$_})
346 203 1962 if defined $attr{$_} and /_char$/
351 1 6 if $attr{'auto_diag'}
354 10 929 if ($sep_aliased)
356 6 4 if (@b > 1) { }
364 21 918 if ($quote_aliased and defined $attr{'quote_char'})
366 7 14 if (@b > 1) { }
376 35 904 if (my $ec = _check_sanity($self))
378 1 34 if $attr{'auto_diag'}
381 6 898 if (defined $self->{'callbacks'} and ref $self->{'callbacks'} ne "HASH")
387 8 896 if defined $\ and not exists $attr{'eol'}
389 1 903 if defined $self->{'types'}
390 904 0 if defined $self->{'skip_empty_rows'}
391 36 868 if defined $attr_formula
447 11101 8 if defined $val
449 910 10199 if $ec = _check_sanity($self)
456 1 5643 unless defined $val
472 3601 1235 if (@_)
481 11 9 if (@_)
483 1 10 unless defined $quote
486 5 6 if (@b > 1) { }
487 1 4 if @b > 16
497 1 9 if $ec
502 6 12 defined $quote && length $quote ? :
507 3595 1232 if (@_)
510 6 3474 unless $ec
517 3913 1243 if (@_)
526 327 33 if (@_)
528 1 326 unless defined $sep
531 13 314 if (@b > 1) { }
532 1 12 if @b > 16
542 1 322 if $ec
547 21 334 defined $sep && length $sep ? :
552 125 32 if (@_)
554 3 122 unless defined $eol
555 1 124 if length $eol > 16
564 1800 1233 if @_
570 6 4 if @_
576 3 2 if @_
582 4 2 if @_
590 6 1 if @_
596 12 9 if @_
602 1 1 if @_
608 1 924 unless defined $f
609 5 42 if ($self and $f and ref $f and ref $f eq "CODE")
619 0 0 $f =~ /^(?: 6 | cb )$/xi ? :
5 0 $f =~ /^(?: 5 | error )$/xi ? :
6 5 $f =~ /^(?: 4 | croak )$/xi ? :
6 11 $f =~ /^(?: 3 | die )$/xi ? :
7 17 $f =~ /^(?: 2 | eof | stop )$/xi ? :
18 24 $f =~ /^(?: 1 | skip )$/xi ? :
877 42 $f =~ /^(?: 0 | undef )$/xi ? :
627 21 2 if @_
629 22 1 unless $ser == 6
632 3 1 $ser == 5 ? :
3 4 $ser == 4 ? :
3 7 $ser == 3 ? :
5 10 $ser == 2 ? :
8 15 $ser <= 1 ? :
639 0 17 if $em =~ s/^\d+$//
640 0 17 $em =~ /[;\n]$/ ? :
646 1 102 unless defined $f
647 6 83 if ($self and $f and ref $f and ref $f eq "CODE")
657 2 7 $f =~ /^(?: 6 | cb )$/xi ? :
14 9 $f =~ /^(?: 5 | undef )$/xi ? :
15 23 $f =~ /^(?: 4 | empty | )$/xi ? :
16 38 $f =~ /^(?: 3 | diag )$/xi ? :
13 54 $f =~ /^(?: 2 | croak )$/xi ? :
13 67 $f =~ /^(?: 1 | die )$/xi ? :
16 80 $f =~ /^(?: 0 | none )$/xi ? :
665 29 15 if @_
666 36 2 unless $self->{'formula'} == 6
676 1 1 if @_
682 11 1 if (@_)
684 2 9 if not defined $v or $v eq ""
685 1 1 lc $v eq 'false' ? :
2 9 unless $v =~ /^[0-9]/
693 11 1 if @_
699 11 1 if @_
705 3725 1229 if (@_)
707 4 3721 if _unhealthy_whitespace($self, $aw)
716 3 1 if @_
722 2 1 if @_
728 1 1 if @_
734 7 2 if @_
740 11 1 if (@_)
742 9 2 defined $v ? :
750 14 1 if (@_)
752 13 1 defined $v ? :
760 9 3 if (@_)
762 2 7 if not defined $v or $v eq ""
763 1 1 lc $v eq 'false' ? :
2 7 unless $v =~ /^[0-9]/
771 8 2 if (@_)
773 2 6 if not defined $v or $v eq ""
774 1 1 lc $v eq 'false' ? :
2 6 unless $v =~ /^[0-9]/
795 2 5 if (@_) { }
796 1 1 if (my $types = shift()) { }
815 43 30 if (@_)
818 41 2 if (defined $_[0]) { }
1 1 elsif (@_ > 1) { }
819 2 39 if grep {not defined $_;} @_
820 26 5 @_ % 2 == 0 ? :
8 31 @_ == 1 && ref $_[0] eq 'HASH' ? :
826 14 22 unless $cbk =~ /^[\w.]+$/ and ref $cb->{$cbk} eq "CODE"
829 2 18 if exists $cb->{'error'}
830 18 2 if exists $cb->{'after_parse'}
831 1 19 if exists $cb->{'before_print'}
853 1543 105 if ($self and ref $self and UNIVERSAL::isa($self, "Text::CSV_PP") and exists $self->{'_ERROR_DIAG'})
857 251 1292 if exists $self->{'_ERROR_POS'}
859 251 1292 if exists $self->{'_ERROR_FLD'}
862 9 257 if $diag[0] and $self->{'callbacks'} and $self->{'callbacks'}{'error'}
867 285 1424 unless (defined $context)
868 19 266 if ($diag[0] and $diag[0] != 2012)
870 8 11 if $diag[4]
872 4 15 unless ($self and ref $self)
879 2 0 if $self->{'diag_verbose'} and $self->{'_ERROR_INPUT'}
883 12 3 if ($lvl < 2)
885 0 11 if (@c >= 11 and $c[10] and ref $c[10] eq "HASH")
889 0 0 if exists $hints->{'autodie'} and $hints->{'autodie'} or exists $hints->{'guard Fatal'} and not exists $hints->{'no Fatal'}
896 3 12 $lvl > 1 ? :
901 230 1194 $context ? :
914 1400 1 defined $_[0]{'_STRING'} ? :
923 1613 1 ref $_[0]{'_FIELDS'} ? :
931 16 5 $_[0]{'_FFLAGS'} ? :
935 3 26 unless defined $_[0]{'_FFLAGS'}
936 1 24 if $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{"_FFLAGS"};}
938 10 14 $_[0]{'_FFLAGS'}[$_[1]] & 1 ? :
942 1 10 unless defined $_[0]{'_FFLAGS'}
943 1 8 if $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{"_FFLAGS"};}
944 4 4 $_[0]{'_FFLAGS'}[$_[1]] & 2 ? :
949 6 13 unless $self->{'keep_meta_info'}
950 2 11 if $idx < 0 or not ref $self->{'_FFLAGS'}
951 1 10 if $idx >= @{$self->{'_FFLAGS'};}
952 4 6 $self->{'_FFLAGS'}[$idx] & 16 ? :
975 4 1949 if ref $str
980 1739 207 if (defined $str and $self->__parse($fields, $fflags, $str, 0)) { }
996 294 43 defined $self->{'_COLUMN_NAMES'} ? :
337 684 unless @columns
997 138 546 if @columns == 1 and not defined $columns[0]
999 224 322 if (@columns == 1 and ref $columns[0] eq 'ARRAY') { }
5 317 elsif (join '', map({defined $_ ? ref $_ : '';} @columns)) { }
1002 704 1 defined $_ ? :
1006 1 540 if ($self->{'_BOUND_COLUMNS'} and @columns != @{$self->{'_BOUND_COLUMNS'};})
1010 1262 1 defined $_ ? :
1017 1 333 unless $fh
1021 18 208 if (ref $_ eq "ARRAY")
1025 207 1 if (ref $_ eq "HASH")
1033 1 331 if defined $args{'munge'} and not defined $args{'munge_column_names'}
1034 169 163 unless defined $args{'detect_bom'}
1035 324 8 unless defined $args{'set_column_names'}
1036 311 21 unless defined $args{'munge_column_names'}
1041 324 8 if $args{'set_column_names'}
1042 324 8 if $args{'set_column_names'}
1045 27 305 if (defined $args{'sep_set'})
1046 5 22 unless ref $args{'sep_set'} eq "ARRAY"
1051 0 327 if $^O eq "MSWin32"
1054 2 325 unless defined $hdr and $hdr ne ""
1057 285 40 unless @seps
1059 322 412 if index($hdr, $sep) >= 0
1062 4 321 if keys %sep >= 2
1066 320 1 if ($args{'detect_bom'})
1067 24 296 if ($hdr =~ s/^\x00\x00\xfe\xff//) { }
24 272 elsif ($hdr =~ s/^\xff\xfe\x00\x00//) { }
25 247 elsif ($hdr =~ s/^\xfe\xff//) { }
24 223 elsif ($hdr =~ s/^\xff\xfe//) { }
48 175 elsif ($hdr =~ s/^\xef\xbb\xbf//) { }
1 174 elsif ($hdr =~ s/^\xf7\x64\x4c//) { }
1 173 elsif ($hdr =~ s/^\xdd\x73\x66\x73//) { }
1 172 elsif ($hdr =~ s/^\x0e\xfe\xff//) { }
1 171 elsif ($hdr =~ s/^\xfb\xee\x28//) { }
1 170 elsif ($hdr =~ s/^\x84\x31\x95\x33//) { }
36 134 elsif ($hdr =~ s/^\x{feff}//) { }
1079 150 170 $enc ? :
1081 6 314 if $hdr eq ""
1083 144 170 if ($enc)
1084 0 144 if $ebcdic and $enc eq "utf-ebcdic"
1085 48 96 if ($enc =~ /([13]).le$/)
1091 144 0 if ($enc)
1092 96 48 if ($enc ne "utf-8")
1102 1 314 if ($hdr and $hdr =~ s/\Asep=(\S)([\r\n]+)//i)
1104 1 0 unless length $hdr
1107 142 173 if ($hdr =~ s/^([^\r\n]+)([\r\n]+)([^\r\n].+)\z/$1/s)
1113 0 315 unless open my $h, "<", $hr
1115 2 313 unless my $row = $self->getline($h)
1118 294 19 if ($args{'munge_column_names'} eq 'lc') { }
7 12 elsif ($args{'munge_column_names'} eq 'uc') { }
3 9 elsif ($args{'munge_column_names'} eq 'db') { }
1132 142 171 if ($ahead)
1135 72 70 if $eol =~ /^\r([^\n]|\z)/
1140 2 311 if ref $args{'munge_column_names'} eq "CODE"
1142 2 1 unless $args{'munge_column_names'}{$_}
1 312 if ref $args{'munge_column_names'} eq "HASH"
1144 2 311 if exists $hdr{''}
1145 1 310 unless (keys %hdr == @hdr)
1149 302 8 if $args{'set_column_names'}
1150 195 115 wantarray ? :
1156 2 2 defined $self->{'_BOUND_COLUMNS'} ? :
4 23 unless @refs
1157 5 18 if @refs == 1 and not defined $refs[0]
1159 1 17 if ($self->{'_COLUMN_NAMES'} and @refs != @{$self->{'_COLUMN_NAMES'};})
1163 2 15 if (grep {ref $_ ne "SCALAR";} @refs)
1174 1 125 unless $self->{'_COLUMN_NAMES'}
1175 2 123 unless my $fr = $self->getline(@args)
1176 5 118 if (ref $self->{'_FFLAGS'})
1178 5 0 @$fr ? :
1180 2 1 if @$fr == 1 and !defined($fr->[0]) || $fr->[0] eq ''
1189 2 245 unless ($self->{'_COLUMN_NAMES'})
1201 11 2 if $eol eq ""
1203 1 12 @f == 1 && !defined($f[0]) ? :
1210 1 2 unless $self->{'_COLUMN_NAMES'}
1211 1 1 unless ref $hr eq "HASH"
1222 20 38 unless 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
1234 21 17 if ($type eq "cell")
1239 1 36 unless my($tlr, $tlc, $brr, $brc) = / ^ \s* ([0-9]+ ) \s* , \s* ([0-9]+ ) \s* (?: - \s* ([0-9]+ | \*) \s* , \s* ([0-9]+ | \*) \s* )? $/x
1243 19 17 unless defined $brr
1244 4 26 if $tlr == 0 or $tlc == 0 or $brr ne "*" and $brr == 0 || $brr < $tlr or $brc ne "*" and $brc == 0 || $brc < $tlc
1249 26 2 unless $brc eq "*"
1250 14 14 unless defined $min_row
1251 1 27 if $tlr < $min_row
1252 19 9 if $brr eq "*" or $brr > $max_row
1258 44 33 if ++$r < $min_row
1263 32 45 if $r < $tlr or $brr ne "*" and $r > $brr
1264 36 9 if not defined $lc or $tlc < $lc
1265 5 40 $brc eq '*' ? :
1269 2 31 if (@h)
1273 10 23 if $max_row ne "*" and $r == $max_row
1282 0 25 unless my($from, $to) = /^\s* ([0-9]+) (?: \s* - \s* ([0-9]+ | \* ))? \s* $/x
1285 2 23 if $to eq "*"
1287 3 22 if $from <= 0 or $to < $from
1292 5 9 if $type eq "col"
1296 64 45 if ($type eq "row")
1297 20 44 if ($r > $#r and $eod or $r[$r])
1299 3 17 if (@h)
1306 126 279 $_ > $#r && $eod || $r[$_] ? :
1307 9 36 if (@h)
1319 4 320 @_ == 1 && ref $_[0] eq 'HASH' ? :
0 324 unless my(%attr) = @_ == 1 && ref $_[0] eq 'HASH' ? %{$_[0];} : @_
1324 42 282 if $enc eq "auto"
1325 0 324 $enc =~ s/(:\w.*)// ? :
1326 3 321 if $enc =~ /^[-\w.]+$/
1332 3 321 unless my $in = delete $attr{'in'} || delete $attr{'file'}
1334 0 321 exists $attr{'out'} && !$attr{'out'} ? :
1336 25 296 if ref $in eq "CODE" or ref $in eq "ARRAY"
1338 1 32 if $in and $out and not ref $in and not ref $out
1342 32 288 if ($out)
1343 5 27 if (ref $out and 'ARRAY' eq ref $out || 'HASH' eq ref $out) { }
14 13 elsif (ref $out and 'SCALAR' ne ref $out or 'GLOB' eq ref \$out) { }
1 12 elsif (ref $out and 'SCALAR' eq ref $out and defined $$out and $$out eq 'skip') { }
1355 1 11 unless open $fh, ">", $out
1358 25 6 if ($fh)
1359 1 24 if ($enc)
1363 18 7 unless (defined $attr{'eol'})
1365 1 17 grep(/crlf/, @layers) ? :
1370 24 295 if (ref $in eq 'CODE' or ref $in eq 'ARRAY') { }
25 270 elsif (ref $in eq 'SCALAR') { }
16 254 elsif (ref $in or 'GLOB' eq ref \$in) { }
1376 0 25 unless open $fh, "<", $in
1380 0 16 if (not ref $in and $] < 5.008005) { }
1388 1 252 unless open $fh, "<$enc", $in
1391 0 317 unless $fh or $sink
1423 6 945 if exists $attr{$f} and not exists $attr{$t}
1428 2 8 unless @{$_[1];} > 1
1429 26 0 if defined $_
1430 26 0 if defined $_
1433 3 0 if defined $fltr and not ref $fltr and exists $fltr{$fltr}
1434 2 315 if ref $fltr eq "CODE"
1435 301 16 unless ref $fltr eq "HASH"
1439 288 29 unless defined $attr{'auto_diag'}
1440 316 1 unless defined $attr{'escape_null'}
1441 0 317 unless my $csv = delete $attr{'csv'} || 'Text::CSV_PP'->new(\%attr)
1443 1 316 if defined $form
1445 8 11 if $kh and not ref $kh and $kh =~ /^(?:1|yes|true|internal|auto)$/i
1474 0 324 if @_ and ref $_[0] eq 'Text::CSV_PP' || ref $_[0] eq 'Text::CSV'
1475 1 324 unless @_
1481 2 315 if (ref $hdrs eq "HASH")
1486 24 293 if ($c->{'out'} and not $c->{'sink'})
1488 4 14 if not $hdrs and ref $c->{'kh'} and $c->{'kh'} == \@internal_kh
1490 3 21 if (ref $in eq 'CODE') { }
10 11 elsif (@{$in;} == 0 or ref $in->[0] eq 'ARRAY') { }
1493 3 4 if (ref $row eq "ARRAY")
1497 4 0 if (ref $row eq "HASH")
1498 2 2 if ($hdr)
1499 3 0 unless $hdr{$_}
1508 0 10 if ref $hdrs
1510 2 10 if $c->{'cboi'}
1511 0 12 if $c->{'cbbo'}
1516 5 6 ref $hdrs ? :
1517 2 9 unless defined $hdrs
1519 19 1 unless $hdr{$_}
10 1 if ref $hdrs || $hdrs eq 'auto' and @hdrs
1523 0 17 if $c->{'cboi'}
1524 0 17 if $c->{'cbbo'}
1529 11 13 if $c->{'cls'}
1534 8 119 if (defined $c->{'hd_s'} or defined $c->{'hd_b'} or defined $c->{'hd_m'} or defined $c->{'hd_c'})
1537 3 161 if not defined $c->{'hd_s'} and $c->{'attr'}{'sep_char'}
1539 3 158 if not defined $c->{'hd_s'} and $c->{'attr'}{'sep'}
1540 16 158 if defined $c->{'hd_s'}
1541 162 12 if defined $c->{'hd_b'}
1542 0 8 $hdrs ? :
8 166 if defined $c->{'hd_m'}
1543 0 4 $hdrs ? :
4 170 if defined $c->{'hd_c'}
1546 167 4 if @hdr
1549 15 275 if ($c->{'kh'})
1551 5 10 unless ref $c->{'kh'} eq "ARRAY"
1556 27 258 if ($key)
1557 7 5 unless not ref $key or ref $key eq "ARRAY" and @$key > 1
1561 9 269 if ($val)
1562 1 8 unless $key
1563 3 2 unless not ref $val or ref $val eq "ARRAY" and @$val > 0
1566 5 269 if $c->{'fltr'} and grep /\D/, keys %{$$c{"fltr"};}
1567 220 54 if (defined $hdrs)
1568 48 172 if (not ref $hdrs or ref $hdrs eq "CODE")
1569 1 47 $c->{'hd_b'} ? :
1574 1 47 if (ref $hdrs) { }
1 46 elsif ($hdrs eq 'skip') { }
44 2 elsif ($hdrs eq 'auto') { }
1 1 elsif ($hdrs eq 'lc') { }
1 0 elsif ($hdrs eq 'uc') { }
1575 0 1 unless $has_h
1583 0 44 unless $has_h
1584 127 1 unless $hdr{$_}
1587 0 1 unless $has_h
1591 0 1 unless $has_h
1595 10 210 if $c->{'kh'} and $hdrs
1598 16 258 if ($c->{'fltr'})
1602 7 9 if (ref $hdrs)
1605 5 16 if exists $f{$hdr[$_]}
1613 51 64 if @hdr
1614 63 52 unless $f{$FLD}->($CSV, $ROW)
1623 2 53 $frag ? :
219 55 ref $hdrs ? :
1626 0 219 if exists $h{''}
1627 0 219 unless (keys %h == @h)
1632 17 200 $key ? :
2 217 $frag ? :
1633 5 12 ref $key ? :
1634 2 15 if (my(@mk) = grep({not exists $h{$_};} grep({defined $_;} $k, @f)))
1639 22 4 defined $k ? :
1644 2 3 ref $val ? :
5 21 $val ? :
1653 266 0 if ($ref) { }
1654 4 165 if @row1 and not $c->{'hd_c'} and not ref $hdrs
1659 250 16 if $c->{'cls'}
1660 22 244 if ($ref and $c->{'cbai'} || $c->{'cboi'})
1662 21 1 ref $ref eq 'ARRAY' ? :
1664 34 37 if ref $r eq "HASH"
1665 30 41 if $c->{'cbai'}
1666 46 25 if $c->{'cboi'}
1670 6 260 if ($c->{'sink'})
1671 0 6 unless my $ro = ref $c->{'out'}
1673 1 5 if $ro eq "SCALAR" and ${$c->{'out'};} eq "skip"
1676 0 5 unless $ro eq ref $ref
1679 4 1 if ($ro eq "ARRAY")
1680 2 2 if (@{$c->{'out'};} and @$ref and ref $c->{'out'}[0] eq ref $ref->[0])
1687 1 0 if ($ro eq "HASH")
1699 1 259 unless defined wantarray
1720 27179 843 if ($self->{'_CACHE'}) { }
1724 843 0 if (defined $self->{'sep_char'})
1727 5 838 if (defined $self->{'sep'} and $self->{'sep'} ne "")
1731 5 0 if $sep_len > 1
1735 843 0 if (exists $self->{'quote_char'})
1737 839 4 if (defined $quote_char and length $quote_char) { }
1743 4 839 if (defined $self->{'quote'} and $self->{'quote'} ne "")
1747 4 0 if $quote_len > 1
1751 843 0 if (exists $self->{'escape_char'})
1753 835 8 if (defined $escape_char and length $escape_char) { }
1760 839 4 if (defined $self->{'eol'})
1765 42 797 if ($eol_len == 1 and $eol eq "\r")
1771 1 842 if (defined $self->{'undef_str'}) { }
1773 0 1 if utf8::is_utf8($self->{'undef_str'})
1777 12 831 if (defined $self->{'comment_str'})
1781 1 842 if (defined $self->{'_types'})
1786 4 839 if (defined $self->{'_is_bound'})
1790 301 542 if (defined $self->{'callbacks'})
1793 9 292 if (defined $cb->{'after_parse'} and ref $cb->{'after_parse'} eq "CODE")
1796 1 300 if (defined $cb->{'before_print'} and ref $cb->{'before_print'} eq "CODE")
1808 14331 0 defined $self->{$_} ? :
1811 2529 0 defined $self->{$_} ? :
1813 8 835 if ($ctx->{'escape_char'} eq "\0")
1825 89 27933 if ($ctx->{'is_bound'})
1827 75 14 if ($bound and ref $bound eq 'ARRAY') { }
1838 953 54 $ctx->{'eol'} =~ /\A[\015\012]/ ? :
521 1007 $ctx->{'verbatim'} || $ctx->{'eol_len'} >= 2 ? :
1528 26494 $ctx->{'eol_len'} ? :
1841 14 40 if ($ctx->{'sep_len'} and $ctx->{'sep_len'} > 1 and _is_valid_utf8($ctx->{'sep'}))
1844 0 28 if ($ctx->{'quo_len'} and $ctx->{'quo_len'} > 1 and _is_valid_utf8($ctx->{'quo'}))
1853 990 22589 unless exists $self->{'_CACHE'}
1857 1 22588 if (not defined $key) { }
3122 19466 elsif ($key eq 'sep_char') { }
3369 16097 elsif ($key eq 'quote_char') { }
251 15846 elsif ($key eq '_has_ahead') { }
11 15835 elsif ($key eq '_has_hooks') { }
11 15824 elsif ($key eq '_is_bound') { }
3223 12601 elsif ($key eq 'sep') { }
3377 9224 elsif ($key eq 'quote') { }
112 9112 elsif ($key eq 'eol') { }
11 9101 elsif ($key eq 'undef_str') { }
1879 11 3212 if $len
1880 0 3223 $len == 1 ? :
1885 3 3374 if $len
1886 0 3377 $len == 1 ? :
1889 112 0 if (defined $value)
1893 75 37 $value eq "\r" ? :
1896 9 2 if (defined $value) { }
1898 1 8 if utf8::is_utf8($value)
1912 1 1 unless (exists $self->{'_CACHE'})
1933 1 0 if ($cache->{'sep_len'} and $cache->{'sep_len'} > 1)
1937 1 0 if ($cache->{'quo_len'} and $cache->{'quo_len'} > 1)
1940 0 1 if ($cache->{'types_len'}) { }
1945 0 1 if ($cache->{'bptr'})
1948 1 0 if ($cache->{'tmp'})
1955 23 4 defined $value ? :
23 4 defined $value ? :
1961 3 0 if (defined $value)
1965 3 0 defined $v ? :
1975 0 8 unless defined $str
1984 20233 173 unless $self->{'callbacks'}
1987 48 125 unless $cb and ref $cb eq "CODE"
1990 125 0 if (@res)
1991 64 61 if ref $res[0] eq "SCALAR" and ${$res[0];} eq "skip"
2007 2 21680 if (not defined $quot or $quot eq "\0")
2010 21680 2 if ($esc ne "" and $esc ne "\0")
2011 21678 2 if ($quot ne '') { }
2020 5 1 if ($n < 0 and $ctx->{'is_bound'})
2025 2 21680 $ctx->{'keep_meta_info'} >= 10 && @{[] unless $self->{'_FFLAGS'};} >= $n ? :
2031 14 53889 if ($bound) { }
2034 53889 0 if (@$fields > $i)
2038 0 53903 unless $v_ref
2042 56 53847 unless (defined $value)
2043 8 48 if ($ctx->{'undef_str'}) { }
2044 3 5 if ($ctx->{'undef_flg'})
2055 10 6 if (substr($value, 0, 1) eq "=" and $ctx->{'formula'})
2057 2 4 unless (defined $value)
2063 6282 47559 $ctx->{'always_quote'} ? :
2064 1406 52435 if ($value eq '') { }
2065 6 1400 if $ctx->{'quote_empty'} or $check_meta and $self->is_quoted($i)
2069 20041 32394 if (utf8::is_utf8($value))
2074 5 52430 if $check_meta and $self->is_quoted($i)
2076 46793 5642 if (not $must_be_quoted and $quot ne "")
2083 21559 23632 if $value =~ /\Q$quot\E/ or $sep ne "" and $sep ne "\0" and $value =~ /\Q$sep\E/ or $esc ne "" and $esc ne "\0" and $value =~ /\Q$esc\E/ or $ctx->{'quote_binary'} and $value =~ /[\x00-\x1f\x7f-\xa0]/ or $ctx->{'quote_space'} and $value =~ /[\x09\x20]/
2086 7 52428 if (not $ctx->{'binary'} and $value =~ /[^\x09\x20-\x7E]/)
2093 52426 2 if ($re_esc)
2096 52291 137 if ($ctx->{'escape_null'})
2101 29446 24388 if ($must_be_quoted)
2107 21667 4 defined $ctx->{'eol'} ? :
2115 0 37 unless my $fa = $ctx->{'formula'}
2116 3 34 if ($fa == 1)
2117 3 31 if ($fa == 2)
2119 6 25 if ($fa == 3)
2121 3 3 if ($ctx->{'recno'})
2126 1 5 if (ref $column_names eq "ARRAY" and @$column_names >= $i - 1)
2128 1 0 if defined $column_name
2134 5 20 if ($fa == 4)
2137 5 15 if ($fa == 5)
2141 15 0 if ($fa == 6)
2142 15 0 if (ref $self->{'_FORMULA_CB'} eq "CODE")
2155 5 20284 if (not defined $fields) { }
5 20279 elsif (ref $fields ne 'ARRAY') { }
2164 6 20278 unless $self->__combine(\$str, $fields, 1)
2168 1 20277 unless $io->print($str)
2182 5 3554 if ($state and ($ctx->{'has_hooks'} || 0) & 2)
2191 871 3737 if $ctx->{'eolx'} or $ctx->{'eol_is_cr'}
2193 2665 1943 if ($ctx->{'useIO'} = $useIO) { }
2197 175 2490 if ($ctx->{'has_ahead'} and defined $self->{'_AHEAD'})
2208 0 4608 if ($ctx->{'has_error_input'})
2217 27 4570 if ($ctx->{'strict'})
2219 12 15 if ($ctx->{'strict_n'} != $ctx->{'fld_idx'})
2220 8 4 unless ($ctx->{'useIO'} & 16)
2223 8 4 if ($last_error)
2229 2657 1940 if ($ctx->{'useIO'}) { }
2230 37 2620 if (defined $ctx->{'tmp'} and $ctx->{'used'} < $ctx->{'size'} and $ctx->{'has_ahead'}) { }
2234 534 2086 if ($ctx->{'useIO'} & 16)
2240 1619 1038 if ($fflags)
2241 11 1608 if ($ctx->{'keep_meta_info'}) { }
2251 2 3957 if ($result and $ctx->{'types'})
2255 2 6 unless defined $value
2257 2 4 if ($type == IV()) { }
2 2 elsif ($type == NV()) { }
2273 30 4560 if not $ctx->{'utf8'} and $ctx->{'sep_len'}
2274 18 4572 if not $ctx->{'utf8'} and $ctx->{'quo_len'}
2275 1074 3516 if not $ctx->{'utf8'} and $ctx->{'eol_len'}
2284 227 14678 $_ eq "\000" ? :
18417 31 if defined $_
2293 147 155 if (not $waitingForField and $c eq "" and $hit ne "" and $ctx->{'useIO'} and not $ctx->{'useIO'} & 16)
2299 364 70479 if $seenSomething and $hit eq "" and $c eq ""
2302 22980 51777 unless ($v_ref)
2303 87 22893 if ($ctx->{'is_bound'}) { }
2310 4 22976 unless $v_ref
2318 46016 28737 if (defined $hit and $hit ne "")
2319 10142 35874 if ($waitingForField)
2320 18 2178 if (not $spl and $ctx->{'comment_str'} and $ctx->{'tmp'} =~ /\A\Q$ctx->{'comment_str'}\E/)
2326 0 45998 if ($hit =~ /[^\x09\x20-\x7E]/)
2333 11851 63534 if (defined $c and defined $sep and $c eq $sep) { }
23081 40453 elsif (defined $c and defined $quot and $quot ne "\000" and $c eq $quot) { }
4655 35798 elsif (defined $c and defined $esc and $esc ne "\000" and $c eq $esc) { }
2588 33210 elsif (defined $c and $c eq "\n" || $c eq '' || defined $eol && $c eq $eol && $eol ne "\r") { }
1033 32177 elsif (defined $c and $c eq "\r" and not $ctx->{'verbatim'}) { }
2334 1174 10677 if ($waitingForField) { }
2195 8482 elsif ($ctx->{'flag'} & 1) { }
2337 53 1121 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2342 1174 0 unless ($ctx->{'is_bound'})
2346 8 1166 if ($ctx->{'keep_meta_info'} and $fflags)
2362 11010 12071 if ($waitingForField)
2369 12005 66 if ($ctx->{'flag'} & 1)
2375 4290 7715 if ($ctx->{'allow_whitespace'})
2379 1 89 if ($ctx->{'allow_loose_quotes'} and not defined $esc && $c2 eq $esc)
2387 1311 10694 unless (defined $c2)
2394 9079 1615 if (defined $c2 and defined $sep and $c2 eq $sep)
2402 336 1279 if (defined $c2 and $c2 eq "\n" || defined $eol && $c2 eq $eol)
2409 1258 21 if (defined $esc and $c eq $esc)
2411 51 1207 if (defined $c2 and $c2 eq 0)
2417 1077 130 if (defined $c2 and defined $quot and $c2 eq $quot)
2420 1 1076 if ($ctx->{'utf8'})
2426 4 1 if ($ctx->{'allow_loose_escapes'} and defined $c2 and $c2 ne "\r")
2434 90 57 if (defined $c2 and $c2 eq "\r")
2435 0 90 if ($ctx->{'eol_is_cr'})
2443 76 14 if (defined $c3 and $c3 eq "\n")
2450 1 13 if ($ctx->{'useIO'} and not $ctx->{'eol_len'})
2451 0 1 if ($c3 eq "\r")
2457 1 0 unless ($c3 =~ /[^\x09\x20-\x7E]/)
2469 12 1 $quoesc ? :
2473 10 47 if ($ctx->{'allow_loose_quotes'} and not $quoesc)
2482 39 8 if ($quoesc)
2491 16 50 if ($ctx->{'allow_loose_quotes'}) { }
2501 34 4621 if ($waitingForField) { }
4612 9 elsif ($ctx->{'flag'} & 1) { }
9 0 elsif ($v_ref) { }
2503 4 30 if ($ctx->{'allow_unquoted_escape'})
2510 1 3 unless (defined $c2)
2515 1 2 if ($c2 eq '0') { }
2 0 elsif (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'}) { }
2524 0 2 if ($ctx->{'utf8'})
2536 3 4609 unless (defined $c2)
2541 2 4607 if ($c2 eq '0') { }
4581 26 elsif (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'}) { }
2550 0 4581 if ($ctx->{'utf8'})
2562 4 5 unless (defined $c2)
2576 51 45 if ($fnum == 1 and $ctx->{'flag'} == 0 and !$v_ref || $$v_ref eq '' and $ctx->{'skip_empty_rows'})
2579 3 48 if ($ser == 3)
2580 3 45 if ($ser == 4)
2581 2 43 if ($ser == 5)
2583 33 10 if ($ser <= 2)
2586 4 29 if (not defined $c or $ser == 2)
2589 2 2 if ($ser == 2)
2594 10 29 if ($ser == 6)
2596 0 10 unless ($cb and ref $cb eq "CODE")
2602 2 8 unless (ref $rv eq "ARRAY")
2606 0 8 if ($n <= 0)
2609 0 8 if ($ctx->{'is_bound'} and $ctx->{'is_bound'} < $n)
2621 230 2716 if ($waitingForField)
2624 16 214 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2629 229 1 unless ($ctx->{'is_bound'})
2632 14 216 if ($ctx->{'keep_meta_info'} and $fflags)
2637 779 1937 if ($ctx->{'flag'} & 1) { }
11 1926 elsif ($ctx->{'verbatim'}) { }
2641 29 750 unless ($ctx->{'binary'})
2651 1 10 unless ($ctx->{'binary'})
2655 8 2 unless $ctx->{'eol'} eq $c and $ctx->{'useIO'}
2660 4 15 if (not $ctx->{'recno'} and $ctx->{'fld_idx'} == 1 and $ctx->{'useIO'} and $hit =~ /^sep=(.{1,16})$/i)
2664 4 0 if ($len <= 16)
2665 3 1 $len == 1 ? :
2677 113 920 if ($waitingForField)
2678 29 84 if ($ctx->{'eol_is_cr'})
2686 5 79 unless (defined $c2)
2690 0 5 unless $seenSomething
2693 69 10 if ($c2 eq "\n")
2700 5 5 if ($ctx->{'useIO'} and not $ctx->{'eol_len'})
2701 0 5 if ($c2 eq "\n")
2708 2 3 unless ($c2 =~ /[^\x09\x20-\x7E]/)
2715 1 0 if ($fnum == 1 and $ctx->{'flag'} == 0 and !$v_ref || $$v_ref eq '' and $ctx->{'skip_empty_rows'})
2718 0 1 if ($ser == 3)
2719 0 1 if ($ser == 4)
2720 0 1 if ($ser == 5)
2722 1 0 if ($ser <= 2)
2725 0 1 unless (defined $c)
2732 0 1 if ($ser == 6)
2734 0 0 unless ($cb and ref $cb eq "CODE")
2740 0 0 unless (ref $rv eq "ARRAY")
2744 0 0 if ($n <= 0)
2747 0 0 if ($ctx->{'is_bound'} and $ctx->{'is_bound'} < $n)
2771 593 327 if ($ctx->{'flag'} & 1) { }
2775 70 523 unless ($ctx->{'binary'})
2782 181 146 if ($ctx->{'eol_is_cr'})
2789 130 16 if (defined $c2 and $c2 eq "\n")
2795 11 5 if ($ctx->{'useIO'} and not $ctx->{'eol_len'})
2796 5 6 if (not $c2 =~ /[^\x09\x20-\x7E]/ or $c2 eq "\r")
2807 0 0 if ($fnum == 1 and $ctx->{'flag'} == 0 and !$v_ref || $$v_ref eq '' and $ctx->{'skip_empty_rows'})
2810 0 0 if ($ser == 3)
2811 0 0 if ($ser == 4)
2812 0 0 if ($ser == 5)
2814 0 0 if ($ser <= 2)
2817 0 0 unless (defined $c)
2824 0 0 if ($ser == 6)
2826 0 0 unless ($cb and ref $cb eq "CODE")
2832 0 0 unless (ref $rv eq "ARRAY")
2836 0 0 if ($n <= 0)
2839 0 0 if ($ctx->{'is_bound'} and $ctx->{'is_bound'} < $n)
2862 0 32177 if ($ctx->{'eolx'} and $c eq $eol)
2867 608 31569 if ($waitingForField)
2868 6 179 if (not $spl and $ctx->{'comment_str'} and $ctx->{'tmp'} =~ /\A$ctx->{'comment_str'}/)
2872 231 371 if ($ctx->{'allow_whitespace'} and $self->__is_whitespace($ctx, $c))
2875 1 340 unless defined $c
2882 29469 2100 if ($ctx->{'flag'} & 1) { }
2883 3297 26172 if (not defined $c or $c =~ /[^\x09\x20-\x7E]/)
2885 5 10 unless ($ctx->{'binary'} or $ctx->{'utf8'})
2892 450 1650 if (not defined $c or $c =~ /[^\x09\x20-\x7E]/)
2893 3 447 if $ctx->{'useIO'} and not defined $c
2895 9 0 unless ($ctx->{'binary'} or $ctx->{'utf8'})
2903 3 8442 if $ctx->{'useIO'} and $ctx->{'verbatim'} and $ctx->{'used'} == $ctx->{'size'}
2907 366 57 if ($waitingForField)
2908 32 334 if ($seenSomething or not $ctx->{'useIO'})
2910 31 1 unless ($v_ref)
2911 0 31 if ($ctx->{'is_bound'}) { }
2918 0 31 unless $v_ref
2922 9 23 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2927 32 0 unless ($ctx->{'is_bound'})
2930 3 29 if ($ctx->{'keep_meta_info'} and $fflags)
2939 14 43 if ($ctx->{'flag'} & 1)
2944 41 2 if ($v_ref) { }
2 0 elsif ($ctx->{'flag'} == 0 and $fnum == 1 and $ctx->{'skip_empty_rows'} == 1) { }
2954 2118 4398 if defined $ctx->{'tmp'} and $ctx->{'used'} <= 0
2955 0 4398 if $ctx->{'used'} < $ctx->{'size'}
2956 1365 3033 unless $ctx->{'useIO'}
2958 2496 537 if (defined $res) { }
147 390 elsif (delete $ctx->{'has_leftover'}) { }
2959 0 2496 if ($ctx->{'has_ahead'}) { }
2961 0 0 if $ctx->{'eol_len'}
2967 2496 0 if ($ctx->{'size'} = length $ctx->{'tmp'})
2969 70 2426 if utf8::is_utf8($ctx->{'tmp'})
2977 147 0 if ($ctx->{'size'} = length $ctx->{'tmp'})
2979 0 147 if utf8::is_utf8($ctx->{'tmp'})
2984 334 56 unless defined $ctx->{'tmp'}
3001 3 98 if ($i >= $ctx->{'is_bound'})
3005 98 0 if (ref $ctx->{'bound'} eq "ARRAY")
3007 98 0 if (ref $ref)
3008 14 84 if ($keep)
3011 83 1 unless (&Scalar::Util::readonly($$ref))
3023 0 17443 unless defined $ctx->{'used'}
3024 1365 16078 if ($ctx->{'used'} >= $ctx->{'size'})
3025 28 1337 if ($self->__get_from_src($ctx, $src))
3031 16078 0 if ($ctx->{'tmp'} =~ /\G($ctx->{'_re'}|.)/gs) { }
3033 1222 14856 if ($c =~ /[^\x09\012\015\x20-\x7e]/)
3039 0 0 if ($self->__get_from_src($ctx, $src))
3061 299 0 if $ctx->{'tmp'}
3068 535 4529 unless defined $c
3079 206 21080 if $ctx->{'utf8'}
3080 27 107 if ($ctx->{'formula'} and defined $$v_ref and substr($$v_ref, 0, 1) eq "=")
3082 22 3 defined $value ? :
3085 12 21247 if (!defined($$v_ref) || $$v_ref eq '' and $ctx->{'empty_is_undef'} || !($flag & 1) && $ctx->{'blank_is_undef'}) { }
3091 1725 19522 if ($ctx->{'allow_whitespace'} and not $flag & 1)
3094 2171 1571 if ($flag & 2 and $ctx->{'decode_utf8'} and $ctx->{'utf8'} || _is_valid_utf8($$v_ref))
3098 21178 81 unless ($ctx->{'is_bound'})
3101 88 21171 if ($ctx->{'keep_meta_info'} and $fflags)
3111 1482 137 $res ? :
3123 12 324 if ($offset < 0)
3132 20 720 if ($offset > 0)
3137 12 708 if ($n++ >= $tail and $tail)
3141 117 603 if (($ctx->{'has_hooks'} || 0) & 2)
3142 63 54 unless ($self->_hook("after_parse", \@row))
3150 32 64 if defined $len and $n >= $len and $offset >= 0
3153 8 322 if (defined $len and $n > $len)
3161 2110 1639 $_[0] =~ /^(?: [\x00-\x7F] |[\xC2-\xDF][\x80-\xBF] |[\xE0][\xA0-\xBF][\x80-\xBF] |[\xE1-\xEC][\x80-\xBF][\x80-\xBF] |[\xED][\x80-\x9F][\x80-\xBF] |[\xEE-\xEF][\x80-\xBF][\x80-\xBF] |[\xF0][\x90-\xBF][\x80-\xBF][\x80-\xBF] |[\xF1-\xF3][\x80-\xBF][\x80-\xBF][\x80-\xBF] |[\xF4][\x80-\x8F][\x80-\xBF][\x80-\xBF] )+$/x ? :
3183 0 1 if (defined $pos)
3192 4 2 if ($self and (&Scalar::Util::reftype($self) || '') eq 'HASH' || ref($self) =~ /^Text::CSV/)
3208 6 1694 if ($error == 0)
3214 335 1365 if ($error == 2012)
3217 284 1416 if ($ctx->{'auto_diag'})
3226 1700 1940 if (ref $self) { }
3234 962 2675 if (defined $errstr)
3256 4414 0 ref $left ? :