Branch Coverage

blib/lib/Text/CSV_PP.pm
Criterion Covered Total %
branch 1122 1226 91.5


line true false branch
106 0 32 if ($] < 5.006) { }
0 32 elsif ($] < 5.008) { }
0 32 elsif (not defined &utf8::is_utf8) { }
107 0 0 unless $INC{'bytes.pm'}
124 0 32 if ($@)
126 0 0 if ($@) { }
141 0 0 unless length ref $r
144 0 0 length ref $$r ? :
0 0 exists $tmap{$t} ? :
231 11883 3567 unless $aw
234 3565 2 unless defined $quo and length $quo
237 242 3325 if defined $quo and $quo =~ /^[ \t]/
238 290 3035 if defined $esc and $esc =~ /^[ \t]/
248 12109 35 unless defined $sep and length $sep
250 12126 18 unless defined $quo and length $quo
258 2 12142 unless $sep ne ''
259 1 12141 if length $sep > 16
260 6 12135 if $sep =~ /[\r\n]/
262 12126 9 if (defined $quo)
263 228 11898 if $quo eq $sep
264 1 11897 if length $quo > 16
265 6 11891 if $quo =~ /[\r\n]/
267 11890 10 if (defined $esc)
268 168 11722 if $esc eq $sep
269 6 11716 if $esc =~ /[\r\n]/
271 11722 4 if (defined $eol)
272 1 11721 if length $eol > 16
287 1 788 unless my $class = ref $proto || $proto
288 8 780 if @_ > 0 and ref $_[0] ne 'HASH'
291 1849 1 /^[a-zA-Z]\w+$/ ? :
292 21 1829 if exists $attr_alias{$k}
297 7 773 if (exists $attr{'sep'})
302 25 755 if (exists $attr{'quote'})
307 12 768 if exists $attr{'formula_handling'}
309 32 748 if exists $attr{'formula'}
311 1842 6 if (/^[a-z]/ and exists $def_attr{$_})
313 127 1715 if defined $attr{$_} and /_char$/
318 1 6 if $attr{'auto_diag'}
321 7 765 if ($sep_aliased)
323 6 1 if (@b > 1) { }
331 21 751 if ($quote_aliased and defined $attr{'quote_char'})
333 7 14 if (@b > 1) { }
343 35 737 if (my $ec = _check_sanity($self))
345 1 34 if $attr{'auto_diag'}
348 6 731 if (defined $self->{'callbacks'} and ref $self->{'callbacks'} ne 'HASH')
354 8 729 if defined $\ and not exists $attr{'eol'}
356 1 736 if defined $self->{'types'}
409 6 11067 unless defined $val
412 910 10163 if $ec = _check_sanity($self)
419 1 5641 unless defined $val
435 3600 1235 if (@_)
444 11 9 if (@_)
446 1 10 unless defined $quote
449 5 6 if (@b > 1) { }
450 1 4 if @b > 16
460 1 9 if $ec
465 6 12 defined $quote && length $quote ? :
470 3594 1232 if (@_)
473 5 3474 unless $ec
480 3879 1243 if (@_)
489 293 32 if (@_)
491 1 292 unless defined $sep
494 13 280 if (@b > 1) { }
495 1 12 if @b > 16
505 1 288 if $ec
510 21 299 defined $sep && length $sep ? :
515 125 32 if (@_)
517 3 122 unless defined $eol
518 1 124 if length $eol > 16
527 1800 1233 if @_
533 6 4 if @_
539 3 2 if @_
545 4 2 if @_
553 6 1 if @_
559 12 9 if @_
565 1 1 if @_
573 0 16 if $em =~ s/^\d+$//
574 1 15 $em =~ /[;\n]$/ ? :
580 1 95 unless defined $f
586 14 8 $f =~ /^(?: 5 | undef )$/xi ? :
15 22 $f =~ /^(?: 4 | empty | )$/xi ? :
16 37 $f =~ /^(?: 3 | diag )$/xi ? :
13 53 $f =~ /^(?: 2 | croak )$/xi ? :
13 66 $f =~ /^(?: 1 | die )$/xi ? :
16 79 $f =~ /^(?: 0 | none )$/xi ? :
594 28 15 if @_
604 1 1 if @_
610 11 1 if (@_)
612 2 9 if not defined $v or $v eq ''
613 1 1 lc $v eq 'false' ? :
2 9 unless $v =~ /^[0-9]/
621 11 1 if @_
627 11 1 if @_
633 3725 1229 if (@_)
635 4 3721 if _unhealthy_whitespace($self, $aw)
644 3 1 if @_
650 2 1 if @_
656 1 1 if @_
662 7 2 if @_
668 11 1 if (@_)
670 9 2 defined $v ? :
678 9 3 if (@_)
680 2 7 if not defined $v or $v eq ''
681 1 1 lc $v eq 'false' ? :
2 7 unless $v =~ /^[0-9]/
689 8 2 if (@_)
691 2 6 if not defined $v or $v eq ''
692 1 1 lc $v eq 'false' ? :
2 6 unless $v =~ /^[0-9]/
713 2 5 if (@_) { }
714 1 1 if (my $types = shift()) { }
731 42 30 if (@_)
734 40 2 if (defined $_[0]) { }
1 1 elsif (@_ > 1) { }
735 2 38 if grep {not defined $_;} @_
736 25 5 @_ % 2 == 0 ? :
8 30 @_ == 1 && ref $_[0] eq 'HASH' ? :
742 14 21 unless $cbk =~ /^[\w.]+$/ and ref $cb->{$cbk} eq 'CODE'
745 1 18 if exists $cb->{'error'}
746 18 1 if exists $cb->{'after_parse'}
747 1 18 if exists $cb->{'before_print'}
769 1489 102 if ($self and ref $self and UNIVERSAL::isa($self, 'Text::CSV_PP') and exists $self->{'_ERROR_DIAG'})
773 238 1251 if exists $self->{'_ERROR_POS'}
775 238 1251 if exists $self->{'_ERROR_FLD'}
778 3 220 if $diag[0] and $self->{'callbacks'} and $self->{'callbacks'}{'error'}
783 246 1413 unless (defined $context)
784 12 234 if ($diag[0] and $diag[0] != 2012)
786 6 6 if $diag[4]
788 4 8 unless ($self and ref $self)
794 2 0 if ($self->{'diag_verbose'} and $self->{'_ERROR_INPUT'})
801 7 1 if ($lvl < 2)
803 0 6 if (@c >= 11 and $c[10] and ref $c[10] eq 'HASH')
807 0 0 if exists $hints->{'autodie'} and $hints->{'autodie'} or exists $hints->{'guard Fatal'} and not exists $hints->{'no Fatal'}
814 1 7 $lvl > 1 ? :
819 222 1191 $context ? :
832 1400 1 defined $_[0]{'_STRING'} ? :
841 1593 1 ref $_[0]{'_FIELDS'} ? :
849 16 5 $_[0]{'_FFLAGS'} ? :
853 3 26 unless defined $_[0]{'_FFLAGS'}
854 1 24 if $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{'_FFLAGS'};}
856 10 14 $_[0]{'_FFLAGS'}[$_[1]] & 1 ? :
860 1 10 unless defined $_[0]{'_FFLAGS'}
861 1 8 if $_[1] =~ /\D/ or $_[1] < 0 or $_[1] > $#{$_[0]{'_FFLAGS'};}
862 4 4 $_[0]{'_FFLAGS'}[$_[1]] & 2 ? :
867 6 13 unless $self->{'keep_meta_info'}
868 2 11 if $idx < 0 or not ref $self->{'_FFLAGS'}
869 1 10 if $idx >= @{$self->{'_FFLAGS'};}
870 4 6 $self->{'_FFLAGS'}[$idx] & 16 ? :
893 4 1929 if ref $str
898 1719 207 if (defined $str and $self->__parse($fields, $fflags, $str, 0)) { }
914 266 43 defined $self->{'_COLUMN_NAMES'} ? :
309 616 unless @columns
915 136 480 if @columns == 1 and not defined $columns[0]
917 192 288 if (@columns == 1 and ref $columns[0] eq 'ARRAY') { }
5 283 elsif (join '', map({defined $_ ? ref $_ : '';} @columns)) { }
920 589 1 defined $_ ? :
924 1 474 if ($self->{'_BOUND_COLUMNS'} and @columns != @{$self->{'_BOUND_COLUMNS'};})
928 1035 1 defined $_ ? :
935 1 296 unless $fh
939 18 173 if (ref $_ eq 'ARRAY')
943 172 1 if (ref $_ eq 'HASH')
951 0 295 if defined $args{'munge'} and not defined $args{'munge_column_names'}
952 294 1 unless defined $args{'detect_bom'}
953 287 8 unless defined $args{'set_column_names'}
954 278 17 unless defined $args{'munge_column_names'}
959 287 8 if $args{'set_column_names'}
960 287 8 if $args{'set_column_names'}
963 11 284 if (defined $args{'sep_set'})
964 5 6 unless ref $args{'sep_set'} eq 'ARRAY'
969 0 290 if $^O eq 'MSWin32'
972 2 288 unless defined $hdr and $hdr ne ''
975 264 24 unless @seps
977 283 389 if index($hdr, $sep) >= 0
980 1 287 if keys %sep >= 2
984 286 1 if ($args{'detect_bom'})
985 24 262 if ($hdr =~ s/^\x00\x00\xfe\xff//) { }
24 238 elsif ($hdr =~ s/^\xff\xfe\x00\x00//) { }
25 213 elsif ($hdr =~ s/^\xfe\xff//) { }
24 189 elsif ($hdr =~ s/^\xff\xfe//) { }
48 141 elsif ($hdr =~ s/^\xef\xbb\xbf//) { }
1 140 elsif ($hdr =~ s/^\xf7\x64\x4c//) { }
1 139 elsif ($hdr =~ s/^\xdd\x73\x66\x73//) { }
1 138 elsif ($hdr =~ s/^\x0e\xfe\xff//) { }
1 137 elsif ($hdr =~ s/^\xfb\xee\x28//) { }
1 136 elsif ($hdr =~ s/^\x84\x31\x95\x33//) { }
36 100 elsif ($hdr =~ s/^\x{feff}//) { }
999 6 280 if $hdr eq ''
1001 144 136 if ($enc)
1002 48 96 if ($enc =~ /([13]).le$/)
1008 96 48 if ($enc ne 'utf-8')
1017 142 139 if ($hdr =~ s/^([^\r\n]+)([\r\n]+)([^\r\n].+)\z/$1/s)
1022 266 15 if $args{'munge_column_names'} eq 'lc'
1023 6 275 if $args{'munge_column_names'} eq 'uc'
1026 0 281 unless open my $h, '<', $hr
1028 2 279 unless my $row = $self->getline($h)
1031 142 137 if ($ahead)
1034 72 70 if $eol =~ /^\r([^\n]|\z)/
1039 2 277 if ref $args{'munge_column_names'} eq 'CODE'
1041 2 1 unless $args{'munge_column_names'}{$_}
1 278 if ref $args{'munge_column_names'} eq 'HASH'
1043 2 277 if exists $hdr{''}
1044 1 276 unless (keys %hdr == @hdr)
1048 268 8 if $args{'set_column_names'}
1049 162 114 wantarray ? :
1055 2 2 defined $self->{'_BOUND_COLUMNS'} ? :
4 23 unless @refs
1056 5 18 if @refs == 1 and not defined $refs[0]
1058 1 17 if ($self->{'_COLUMN_NAMES'} and @refs != @{$self->{'_COLUMN_NAMES'};})
1062 2 15 if (grep {ref $_ ne 'SCALAR';} @refs)
1073 1 119 unless $self->{'_COLUMN_NAMES'}
1074 2 117 unless my $fr = $self->getline(@args)
1075 5 112 if (ref $self->{'_FFLAGS'})
1077 5 0 @$fr ? :
1079 2 1 if @$fr == 1 and !defined($fr->[0]) || $fr->[0] eq ''
1088 2 203 unless ($self->{'_COLUMN_NAMES'})
1100 11 2 if $eol eq ''
1102 1 12 @f == 1 && !defined($f[0]) ? :
1109 1 2 unless $self->{'_COLUMN_NAMES'}
1110 1 1 unless ref $hr eq 'HASH'
1121 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
1133 21 17 if ($type eq 'cell')
1138 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
1142 19 17 unless defined $brr
1143 4 26 if $tlr == 0 or $tlc == 0 or $brr ne '*' and $brr == 0 || $brr < $tlr or $brc ne '*' and $brc == 0 || $brc < $tlc
1148 26 2 unless $brc eq '*'
1149 14 14 unless defined $min_row
1150 1 27 if $tlr < $min_row
1151 19 9 if $brr eq '*' or $brr > $max_row
1157 44 33 if ++$r < $min_row
1162 32 45 if $r < $tlr or $brr ne '*' and $r > $brr
1163 36 9 if not defined $lc or $tlc < $lc
1164 5 40 $brc eq '*' ? :
1168 2 31 if (@h)
1172 10 23 if $max_row ne '*' and $r == $max_row
1181 0 25 unless my($from, $to) = /^\s* ([0-9]+) (?: \s* - \s* ([0-9]+ | \* ))? \s* $/x
1184 2 23 if $to eq '*'
1186 3 22 if $from <= 0 or $to < $from
1191 5 9 if $type eq 'col'
1195 64 45 if ($type eq 'row')
1196 20 44 if ($r > $#r and $eod or $r[$r])
1198 3 17 if (@h)
1205 126 279 $_ > $#r && $eod || $r[$_] ? :
1206 9 36 if (@h)
1218 4 262 @_ == 1 && ref $_[0] eq 'HASH' ? :
0 266 unless my(%attr) = @_ == 1 && ref $_[0] eq 'HASH' ? %{$_[0];} : @_
1223 42 224 if $enc eq 'auto'
1224 3 263 if $enc =~ /^[-\w.]+$/
1229 3 263 unless my $in = delete $attr{'in'} || delete $attr{'file'}
1231 0 263 exists $attr{'out'} && !$attr{'out'} ? :
1233 20 243 if ref $in eq 'CODE' or ref $in eq 'ARRAY'
1235 1 22 if $in and $out and not ref $in and not ref $out
1239 22 240 if ($out)
1240 13 9 if (ref $out and 'SCALAR' ne ref $out or 'GLOB' eq ref \$out) { }
1 8 elsif (ref $out and 'SCALAR' eq ref $out and defined $$out and $$out eq 'skip') { }
1248 1 7 unless open $fh, '>', $out
1251 20 1 if ($fh)
1252 1 19 if $enc
1253 17 3 unless (defined $attr{'eol'})
1255 1 16 grep(/crlf/, @layers) ? :
1260 19 242 if (ref $in eq 'CODE' or ref $in eq 'ARRAY') { }
20 222 elsif (ref $in eq 'SCALAR') { }
16 206 elsif (ref $in or 'GLOB' eq ref \$in) { }
1266 0 20 unless open $fh, '<', $in
1270 0 16 if (not ref $in and $] < 5.008005) { }
1278 1 204 unless open $fh, "<$enc", $in
1281 0 259 unless $fh or $sink
1313 6 771 if exists $attr{$f} and not exists $attr{$t}
1318 2 8 unless @{$_[1];} > 1
1319 26 0 if defined $_
1320 26 0 if defined $_
1323 3 0 if defined $fltr and not ref $fltr and exists $fltr{$fltr}
1324 2 257 if ref $fltr eq 'CODE'
1325 243 16 unless ref $fltr eq 'HASH'
1328 0 259 if exists $attr{'formula'}
1330 246 13 unless defined $attr{'auto_diag'}
1331 258 1 unless defined $attr{'escape_null'}
1332 0 259 unless my $csv = delete $attr{'csv'} || 'Text::CSV_PP'->new(\%attr)
1361 9 257 if @_ and ref $_[0] eq 'Text::CSV_PP' || ref $_[0] eq 'Text::CSV'
1362 1 266 unless @_
1368 2 257 if (ref $hdrs eq 'HASH')
1373 19 240 if ($c->{'out'} and not $c->{'sink'})
1374 3 16 if (ref $in eq 'CODE') { }
9 7 elsif (ref $in->[0] eq 'ARRAY') { }
1377 3 4 if (ref $row eq 'ARRAY')
1381 4 0 if (ref $row eq 'HASH')
1382 2 2 if ($hdr)
1383 3 0 unless $hdr{$_}
1392 0 9 if ref $hdrs
1394 2 10 if $c->{'cboi'}
1395 0 12 if $c->{'cbbo'}
1400 1 6 ref $hdrs ? :
1401 2 5 unless defined $hdrs
1403 7 1 unless $hdr{$_}
6 1 if ref $hdrs or $hdrs eq 'auto'
1407 0 9 if $c->{'cboi'}
1408 0 9 if $c->{'cbbo'}
1413 7 12 if $c->{'cls'}
1418 7 95 if (defined $c->{'hd_s'} or defined $c->{'hd_b'} or defined $c->{'hd_m'} or defined $c->{'hd_c'})
1420 4 141 if defined $c->{'hd_s'}
1421 0 145 if defined $c->{'hd_d'}
1422 0 7 $hdrs ? :
7 138 if defined $c->{'hd_m'}
1423 0 4 $hdrs ? :
4 141 if defined $c->{'hd_c'}
1426 141 4 if @hdr
1429 11 229 if ($c->{'kh'})
1430 5 6 unless ref $c->{'kh'} eq 'ARRAY'
1435 26 209 if ($key)
1436 7 5 unless not ref $key or ref $key eq 'ARRAY' and @$key > 1
1440 9 219 if ($val)
1441 1 8 unless $key
1442 3 2 unless not ref $val or ref $val eq 'ARRAY' and @$val > 0
1445 5 219 if $c->{'fltr'} and grep /\D/, keys %{$$c{'fltr'};}
1446 188 36 if (defined $hdrs)
1447 40 148 if (not ref $hdrs) { }
1 147 elsif (ref $hdrs eq 'CODE') { }
1448 1 39 if ($hdrs eq 'skip') { }
37 2 elsif ($hdrs eq 'auto') { }
1 1 elsif ($hdrs eq 'lc') { }
1 0 elsif ($hdrs eq 'uc') { }
1452 0 37 unless my $h = $csv->getline($fh)
1453 107 1 unless $hdr{$_}
1456 0 1 unless my $h = $csv->getline($fh)
1460 0 1 unless my $h = $csv->getline($fh)
1465 0 1 unless my $h = $csv->getline($fh)
1469 6 182 if $c->{'kh'} and $hdrs
1472 16 208 if ($c->{'fltr'})
1476 7 9 if (ref $hdrs)
1479 5 16 if exists $f{$hdr[$_]}
1487 51 64 if @hdr
1488 63 52 unless $f{$FLD}->($CSV, $ROW)
1497 2 35 $frag ? :
187 37 ref $hdrs ? :
1500 0 187 if exists $h{''}
1501 0 187 unless (keys %h == @h)
1506 16 169 $key ? :
2 185 $frag ? :
1507 5 11 ref $key ? :
1508 2 14 if (my(@mk) = grep({not exists $h{$_};} grep({defined $_;} $k, @f)))
1513 21 4 defined $k ? :
1518 2 3 ref $val ? :
5 20 $val ? :
1527 222 0 if ($ref) { }
1528 4 141 if @row1 and not $c->{'hd_c'} and not ref $hdrs
1533 206 16 if $c->{'cls'}
1534 22 200 if ($ref and $c->{'cbai'} || $c->{'cboi'})
1536 21 1 ref $ref eq 'ARRAY' ? :
1538 34 37 if ref $r eq 'HASH'
1539 30 41 if $c->{'cbai'}
1540 46 25 if $c->{'cboi'}
1544 1 221 if $c->{'sink'}
1547 1 220 unless defined wantarray
1567 26802 678 if ($self->{'_CACHE'}) { }
1571 678 0 if (defined $self->{'sep_char'})
1574 5 673 if (defined $self->{'sep'} and $self->{'sep'} ne '')
1578 5 0 if $sep_len > 1
1582 678 0 if (exists $self->{'quote_char'})
1584 674 4 if (defined $quote_char and length $quote_char) { }
1590 4 674 if (defined $self->{'quote'} and $self->{'quote'} ne '')
1594 4 0 if $quote_len > 1
1598 678 0 if (exists $self->{'escape_char'})
1600 670 8 if (defined $escape_char and length $escape_char) { }
1607 674 4 if (defined $self->{'eol'})
1612 40 634 if ($eol_len == 1 and $eol eq "\r")
1618 1 677 if (defined $self->{'undef_str'}) { }
1620 0 1 if utf8::is_utf8($self->{'undef_str'})
1625 1 677 if (defined $self->{'_types'})
1630 4 674 if (defined $self->{'_is_bound'})
1634 248 430 if (defined $self->{'callbacks'})
1637 9 239 if (defined $cb->{'after_parse'} and ref $cb->{'after_parse'} eq 'CODE')
1640 1 247 if (defined $cb->{'before_print'} and ref $cb->{'before_print'} eq 'CODE')
1652 10848 0 defined $self->{$_} ? :
1655 2034 0 defined $self->{$_} ? :
1657 8 670 if ($ctx->{'escape_char'} eq "\000")
1669 89 27391 if ($ctx->{'is_bound'})
1671 75 14 if ($bound and ref $bound eq 'ARRAY') { }
1682 876 54 $ctx->{'eol'} =~ /\A[\015\012]/ ? :
508 930 $ctx->{'verbatim'} || $ctx->{'eol_len'} >= 2 ? :
1438 26042 $ctx->{'eol_len'} ? :
1685 14 40 if ($ctx->{'sep_len'} and $ctx->{'sep_len'} > 1 and _is_valid_utf8($ctx->{'sep'}))
1688 0 28 if ($ctx->{'quo_len'} and $ctx->{'quo_len'} > 1 and _is_valid_utf8($ctx->{'quo'}))
1697 823 22573 unless exists $self->{'_CACHE'}
1701 1 22572 if (not defined $key) { }
3120 19452 elsif ($key eq 'sep_char') { }
3368 16084 elsif ($key eq 'quote_char') { }
249 15835 elsif ($key eq '_has_ahead') { }
11 15824 elsif ($key eq '_has_hooks') { }
11 15813 elsif ($key eq '_is_bound') { }
3219 12594 elsif ($key eq 'sep') { }
3376 9218 elsif ($key eq 'quote') { }
112 9106 elsif ($key eq 'eol') { }
11 9095 elsif ($key eq 'undef_str') { }
1723 11 3208 if $len
1724 0 3219 $len == 1 ? :
1729 3 3373 if $len
1730 0 3376 $len == 1 ? :
1733 112 0 if (defined $value)
1737 75 37 $value eq "\r" ? :
1740 9 2 if (defined $value) { }
1742 1 8 if utf8::is_utf8($value)
1756 1 1 unless (exists $self->{'_CACHE'})
1777 1 0 if ($cache->{'sep_len'} and $cache->{'sep_len'} > 1)
1781 1 0 if ($cache->{'quo_len'} and $cache->{'quo_len'} > 1)
1788 22 4 defined $value ? :
22 4 defined $value ? :
1794 3 0 if (defined $value)
1798 3 0 defined $v ? :
1808 0 6 unless defined $str
1817 20233 161 unless $self->{'callbacks'}
1820 36 125 unless $cb and ref $cb eq 'CODE'
1823 125 0 if (@res)
1824 64 61 if ref $res[0] eq 'SCALAR' and ${$res[0];} eq 'skip'
1840 1 21669 if (not defined $quot or $quot eq "\000")
1843 21668 2 if ($esc ne '' and $esc ne "\000")
1844 21667 1 if ($quot ne '') { }
1853 5 1 if ($n < 0 and $ctx->{'is_bound'})
1858 2 21668 $ctx->{'keep_meta_info'} >= 10 && @{[] unless $self->{'_FFLAGS'};} >= $n ? :
1864 14 53853 if ($bound) { }
1867 53853 0 if (@$fields > $i)
1871 0 53867 unless $v_ref
1875 56 53811 unless (defined $value)
1876 8 48 if ($ctx->{'undef_str'}) { }
1877 3 5 if ($ctx->{'undef_flg'})
1888 10 6 if (substr($value, 0, 1) eq '=' and $ctx->{'formula'})
1890 2 4 unless (defined $value)
1896 6282 47523 $ctx->{'always_quote'} ? :
1897 1402 52403 if ($value eq '') { }
1898 6 1396 if $ctx->{'quote_empty'} or $check_meta and $self->is_quoted($i)
1902 20041 32362 if (utf8::is_utf8($value))
1907 5 52398 if $check_meta and $self->is_quoted($i)
1909 46764 5639 if (not $must_be_quoted and $quot ne '')
1916 21559 23603 if $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]/
1919 7 52396 if (not $ctx->{'binary'} and $value =~ /[^\x09\x20-\x7E]/)
1926 52394 2 if ($re_esc)
1929 52296 100 if ($ctx->{'escape_null'})
1934 29446 24352 if ($must_be_quoted)
1940 21655 4 defined $ctx->{'eol'} ? :
1948 0 22 unless my $fa = $ctx->{'formula'}
1949 3 19 if ($fa == 1)
1950 3 16 if ($fa == 2)
1952 6 10 if ($fa == 3)
1954 3 3 if ($ctx->{'recno'})
1959 1 5 if (ref $column_names eq 'ARRAY' and @$column_names >= $i - 1)
1961 1 0 if defined $column_name
1967 5 5 if ($fa == 4)
1970 5 0 if ($fa == 5)
1981 5 20272 if (not defined $fields) { }
5 20267 elsif (ref $fields ne 'ARRAY') { }
1990 6 20266 unless $self->__combine(\$str, $fields, 1)
1994 1 20265 unless $io->print($str)
2008 5 3350 if ($state and ($ctx->{'has_hooks'} || 0) & 2)
2017 822 3350 if $ctx->{'eolx'} or $ctx->{'eol_is_cr'}
2019 2249 1923 if ($ctx->{'useIO'} = $useIO) { }
2023 168 2081 if ($ctx->{'has_ahead'} and defined $self->{'_AHEAD'})
2034 0 4172 if ($ctx->{'has_error_input'})
2043 15 4154 if ($ctx->{'strict'})
2045 6 9 if ($ctx->{'strict_n'} != $ctx->{'fld_idx'})
2046 4 2 unless ($ctx->{'useIO'} & 16)
2053 2249 1920 if ($ctx->{'useIO'}) { }
2054 30 2219 if (defined $ctx->{'tmp'} and $ctx->{'used'} < $ctx->{'size'} and $ctx->{'has_ahead'}) { }
2058 451 1768 if ($ctx->{'useIO'} & 16)
2064 1435 814 if ($fflags)
2065 11 1424 if ($ctx->{'keep_meta_info'}) { }
2075 2 3590 if ($result and $ctx->{'types'})
2079 2 6 unless defined $value
2081 2 4 if ($type == IV()) { }
2 2 elsif ($type == NV()) { }
2097 30 4124 if not $ctx->{'utf8'} and $ctx->{'sep_len'}
2098 18 4136 if not $ctx->{'utf8'} and $ctx->{'quo_len'}
2099 1014 3140 if not $ctx->{'utf8'} and $ctx->{'eol_len'}
2107 227 13315 $_ eq "\000" ? :
16678 26 if defined $_
2116 147 155 if (not $waitingForField and $c eq '' and $hit ne '' and $ctx->{'useIO'} and not $ctx->{'useIO'} & 16)
2122 352 69548 if $seenSomething and $hit eq '' and $c eq ''
2125 21981 51459 unless ($v_ref)
2126 87 21894 if ($ctx->{'is_bound'}) { }
2133 4 21977 unless $v_ref
2140 45080 28356 if (defined $hit and $hit ne '')
2141 9336 35744 if ($waitingForField)
2144 0 45080 if ($hit =~ /[^\x09\x20-\x7E]/)
2151 11291 62794 if (defined $c and defined $sep and $c eq $sep) { }
22864 39930 elsif (defined $c and defined $quot and $quot ne "\000" and $c eq $quot) { }
4655 35275 elsif (defined $c and defined $esc and $esc ne "\000" and $c eq $esc) { }
2354 32921 elsif (defined $c and $c eq "\n" || $c eq '' || defined $eol && $c eq $eol && $eol ne "\r") { }
962 31959 elsif (defined $c and $c eq "\r" and not $ctx->{'verbatim'}) { }
2152 1165 10126 if ($waitingForField) { }
2186 7940 elsif ($ctx->{'flag'} & 1) { }
2155 53 1112 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2160 1165 0 unless ($ctx->{'is_bound'})
2164 8 1157 if ($ctx->{'keep_meta_info'} and $fflags)
2180 10906 11958 if ($waitingForField)
2187 11904 54 if ($ctx->{'flag'} & 1)
2193 4290 7614 if ($ctx->{'allow_whitespace'})
2197 1 89 if ($ctx->{'allow_loose_quotes'} and not defined $esc && $c2 eq $esc)
2205 1311 10593 unless (defined $c2)
2212 9017 1576 if (defined $c2 and defined $sep and $c2 eq $sep)
2220 301 1275 if (defined $c2 and $c2 eq "\n" || defined $eol && $c2 eq $eol)
2227 1254 21 if (defined $esc and $c eq $esc)
2229 51 1203 if (defined $c2 and $c2 eq '0')
2235 1077 126 if (defined $c2 and defined $quot and $c2 eq $quot)
2238 1 1076 if ($ctx->{'utf8'})
2244 4 1 if ($ctx->{'allow_loose_escapes'} and defined $c2 and $c2 ne "\r")
2252 88 55 if (defined $c2 and $c2 eq "\r")
2253 0 88 if ($ctx->{'eol_is_cr'})
2261 74 14 if (defined $c3 and $c3 eq "\n")
2268 1 0 if ($ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c3 =~ /[^\x09\x20-\x7E]/)
2279 12 1 $quoesc ? :
2283 10 45 if ($ctx->{'allow_loose_quotes'} and not $quoesc)
2292 37 8 if ($quoesc)
2301 4 50 if ($ctx->{'allow_loose_quotes'}) { }
2311 34 4621 if ($waitingForField) { }
4612 9 elsif ($ctx->{'flag'} & 1) { }
9 0 elsif ($v_ref) { }
2313 4 30 if ($ctx->{'allow_unquoted_escape'})
2320 1 3 unless (defined $c2)
2325 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'}) { }
2334 0 2 if ($ctx->{'utf8'})
2346 3 4609 unless (defined $c2)
2351 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'}) { }
2360 0 4581 if ($ctx->{'utf8'})
2372 4 5 unless (defined $c2)
2386 121 2233 if ($waitingForField)
2389 8 113 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2394 120 1 unless ($ctx->{'is_bound'})
2397 6 115 if ($ctx->{'keep_meta_info'} and $fflags)
2402 767 1466 if ($ctx->{'flag'} & 1) { }
11 1455 elsif ($ctx->{'verbatim'}) { }
2406 29 738 unless ($ctx->{'binary'})
2416 1 10 unless ($ctx->{'binary'})
2420 8 2 unless $ctx->{'eol'} eq $c and $ctx->{'useIO'}
2425 4 6 if (not $ctx->{'recno'} and $ctx->{'fld_idx'} == 1 and $ctx->{'useIO'} and $hit =~ /^sep=(.{1,16})$/i)
2429 4 0 if ($len <= 16)
2430 3 1 $len == 1 ? :
2442 92 870 if ($waitingForField)
2444 18 74 if ($ctx->{'eol_is_cr'})
2452 5 69 unless (defined $c2)
2458 60 9 if ($c2 eq "\n")
2465 1 3 if ($ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c2 =~ /[^\x09\x20-\x7E]/)
2482 593 277 if ($ctx->{'flag'} & 1) { }
2486 70 523 unless ($ctx->{'binary'})
2493 154 123 if ($ctx->{'eol_is_cr'})
2501 108 15 if (defined $c2 and $c2 eq "\n")
2508 4 6 if ($ctx->{'useIO'} and not $ctx->{'eol_len'} and not $c2 =~ /[^\x09\x20-\x7E]/)
2526 0 31959 if ($ctx->{'eolx'} and $c eq $eol)
2531 553 31406 if ($waitingForField)
2532 231 322 if ($ctx->{'allow_whitespace'} and $self->__is_whitespace($ctx, $c))
2535 1 340 unless defined $c
2542 29395 2011 if ($ctx->{'flag'} & 1) { }
2543 3249 26146 if (not defined $c or $c =~ /[^\x09\x20-\x7E]/)
2545 2 10 unless ($ctx->{'binary'} or $ctx->{'utf8'})
2552 407 1604 if (not defined $c or $c =~ /[^\x09\x20-\x7E]/)
2554 9 0 unless ($ctx->{'binary'} or $ctx->{'utf8'})
2562 3 7741 if $ctx->{'useIO'} and $ctx->{'verbatim'} and $ctx->{'used'} == $ctx->{'size'}
2566 316 52 if ($waitingForField)
2567 32 284 if ($seenSomething or not $ctx->{'useIO'})
2569 31 1 unless ($v_ref)
2570 0 31 if ($ctx->{'is_bound'}) { }
2577 0 31 unless $v_ref
2581 9 23 if ($ctx->{'blank_is_undef'} or $ctx->{'empty_is_undef'}) { }
2586 32 0 unless ($ctx->{'is_bound'})
2589 3 29 if ($ctx->{'keep_meta_info'} and $fflags)
2598 14 38 if ($ctx->{'flag'} & 1)
2603 38 0 if ($v_ref)
2611 2091 2585 if defined $ctx->{'tmp'} and $ctx->{'used'} <= 0
2612 0 2585 if $ctx->{'used'} < $ctx->{'size'}
2613 61 2524 unless $ctx->{'useIO'}
2615 2073 451 if (defined $res) { }
147 304 elsif (delete $ctx->{'has_leftover'}) { }
2616 0 2073 if ($ctx->{'has_ahead'}) { }
2618 0 0 if $ctx->{'eol_len'}
2624 2073 0 if ($ctx->{'size'} = length $ctx->{'tmp'})
2626 70 2003 if utf8::is_utf8($ctx->{'tmp'})
2634 147 0 if ($ctx->{'size'} = length $ctx->{'tmp'})
2636 0 147 if utf8::is_utf8($ctx->{'tmp'})
2641 284 20 unless defined $ctx->{'tmp'}
2658 3 98 if ($i >= $ctx->{'is_bound'})
2662 98 0 if (ref $ctx->{'bound'} eq 'ARRAY')
2664 98 0 if (ref $ref)
2665 14 84 if ($keep)
2668 83 1 unless (&Scalar::Util::readonly($$ref))
2680 0 17245 unless defined $ctx->{'used'}
2681 1335 15910 if $ctx->{'used'} >= $ctx->{'size'}
2683 15910 0 if ($ctx->{'tmp'} =~ /\G($ctx->{'_re'}|.)/gs) { }
2685 1896 14014 if ($c =~ /[^\x09\x20-\x7e]/)
2710 290 0 if $ctx->{'tmp'}
2717 535 4529 unless defined $c
2728 207 20193 if $ctx->{'utf8'}
2729 12 50 if ($ctx->{'formula'} and $$v_ref and substr($$v_ref, 0, 1) eq '=')
2731 7 3 defined $value ? :
2734 20 20368 if (!defined($$v_ref) || $$v_ref eq '' and $ctx->{'empty_is_undef'} || !($flag & 1) && $ctx->{'blank_is_undef'}) { }
2740 1756 18612 if ($ctx->{'allow_whitespace'} and not $flag & 1)
2743 2266 1628 if ($flag & 2 and $ctx->{'decode_utf8'} and $ctx->{'utf8'} || _is_valid_utf8($$v_ref))
2747 20307 81 unless ($ctx->{'is_bound'})
2750 96 20292 if ($ctx->{'keep_meta_info'} and $fflags)
2760 1313 122 $res ? :
2772 12 252 if ($offset < 0)
2781 12 550 if ($offset > 0)
2786 12 538 if ($n++ >= $tail and $tail)
2790 117 433 if (($ctx->{'has_hooks'} || 0) & 2)
2791 63 54 unless ($self->_hook('after_parse', \@row))
2799 12 56 if defined $len and $n >= $len and $offset >= 0
2802 8 256 if (defined $len and $n > $len)
2810 2204 1696 $_[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 ? :
2832 0 1 if (defined $pos)
2841 4 2 if ($self and (&Scalar::Util::reftype($self) || '') eq 'HASH' || ref($self) =~ /^Text::CSV/)
2857 4 1622 if ($error == 0)
2863 285 1341 if ($error == 2012)
2866 239 1387 if ($ctx->{'auto_diag'})
2875 1626 1601 if (ref $self) { }
2882 796 2430 if (defined $errstr)
2904 4302 0 ref $left ? :