Branch Coverage

blib/lib/Spreadsheet/Edit.pm
Criterion Covered Total %
branch 186 690 26.9


line true false branch
115 9 21 $Type eq 'Array' ? :
6 30 $Type eq 'Hash' ? :
121 0 36 if $@
259 0 0 ref $_[0] eq 'HASH' ? :
0 0 ref $_[0] eq 'ARRAY' ? :
4 0 @_ != 1 ? :
263 0 0 if wantarray
266 0 4 @_ % 2 != 0 ? :
0 4 @_ == 1 && ref $_[0] eq 'HASH' ? :
302 0 0 if (/^\w/u) { }
303 0 0 if ($barewords++) { }
306 0 0 if $s
310 0 0 if ($barewords)
314 0 0 if $s
318 0 0 if $barewords
327 0 0 if @_ == 1
328 0 0 if $result
351 0 0 if ($_ eq "\n" or $llen > $indent and $llen + length($_) > $foldwidth)
355 0 0 if $_ eq "\n"
357 0 0 if ($llen == 0) { }
361 0 0 if (substr($buf, -1) =~ /\S/u)
375 0 0 if (ref $colspec eq 'Regexp') { }
380 0 0 if (index($colspec, $left) < 0 and index($colspec, $right) < 0)
388 0 0 unless defined $cx
390 0 0 $colspec eq "$cx" ? :
394 28 0 defined $cx ? :
466 0 14 unless defined $title
467 14 0 unless $title eq "" or $title eq "^" or $title eq "\$"
488 0 14 if $title eq ""
489 0 14 if ($seen{$title}++)
490 0 0 unless $$$self{"silent"}
495 0 14 if (&__unindexed_title($title, $num_cols)) { }
519 0 2 if exists $opts{"package"}
521 0 2 $opts{'package'} ? :
522 0 2 unless defined $userpkg and $userpkg =~ /^[a-zA-Z][:\w]*$/a
530 0 2 if $$$sheet{"verbose"}
578 0 274 unless ref($sheet) =~ /^Spreadsheet::Edit\b/u
579 274 0 unless $sheet->sheetname
583 208 77 if (@_ > 0 and ref $_[0])
584 24 184 if (ref($_[0]) =~ /^Spreadsheet::Edit\b/u) { }
184 0 elsif (ref $_[0] eq 'ARRAY' and @{$_[0];} <= 2 and ref($_[0][0]) . '' =~ /^Spreadsheet::Edit\b/u) { }
594 77 208 unless (defined $sheet)
597 22 263 unless (defined $sheet)
600 125 160 unless (defined $rx)
601 114 11 if defined $sheet
604 274 11 if (defined $sheet)
606 80 194 if (defined $rx and $rx < 0 || $rx > $#{$sheet->rows;}) { }
610 121 73 if defined $rx
615 49 236 $msgstr =~ /\n\z/su ? :
617 0 285 if ($msgstr =~ s/\A(\n+)([^\n])/$2/su)
645 0 53 unless defined $frame[0]
646 15 38 if ($frame[3] =~ /::([a-z][^:]*)/u)
647 13 2 unless wantarray
650 2 0 if ($hasargs)
652 0 2 if $@
681 0 1 if index($pkg, "Spreadsheet::Edit") == 0
697 0 4 if exists $$opthash{$key}
699 0 4 if exists $$new_args{$key}
728 10 1110 unless defined &blessed($_[0]) and $_[0]->isa("Spreadsheet::Edit") and shift @_
731 0 841 unless (&__self_ifexists)
738 0 279 unless (&__self_ifexists)
755 12 23 ref $_[0] eq 'HASH' ? :
769 0 274 if @_
774 0 553 if @_
782 0 2 if $Nargs != @_
794 0 10 unless defined $opthash
797 0 1 unless &first(sub {
800 0 1 if $opts{"undef_ok"} and not defined $$opthash{$k} and not grep({$_ eq $k;} @{$opts{"undef_ok"};})
815 2 28 if (exists $$opthash{$key})
829 0 0 unless defined $_[0]
830 0 0 unless $_[0] ne ""
831 0 0 unless $_[0] eq &title2ident($_[0])
839 0 0 unless defined $opthash
842 0 0 unless &first(sub {
848 0 4 unless defined $_[0] and "$_[0]" =~ /^\d+$/u
854 0 0 unless not defined $_[0] or "$_[0]" =~ /^\d+$/u
861 0 4 unless (scalar(@_) % 2 == 0)
862 0 0 if ref $_[0] eq "HASH"
869 0 1 unless $key =~ /^\w+$/u
877 0 0 unless ($rx // "") =~ /^\d+$/u
880 0 0 $one_past_end_ok ? :
0 0 if $rx > ($one_past_end_ok ? $maxrx + 1 : $maxrx)
888 0 0 if $wantarray
889 0 0 if @_
890 0 0 if defined $wantarray
895 0 0 unless $wantarray or not defined $wantarray
903 0 0 if $$$self{"_carponce"}{$msg}++
904 0 0 unless $msg =~ /\n\z/su
906 0 0 unless $$$self{"silent"}
920 0 4 unless defined $classname and $classname =~ /^[\w_:]+$/u
935 0 4 if (my $clonee = delete $opts{'clone'}) { }
937 0 0 if %opts
974 2 2 if (my $newdata = delete $opts{"rows"})
989 0 4 if $$$self{"verbose"}
1020 0 6 if defined $current_rx
1024 0 12 unless &__looks_like_aref($row)
1027 0 30 if ref $$row[$cx]
1034 6 0 if defined $_
0 6 unless ref $linenums eq "ARRAY" and &all(sub {
1036 4 2 if (@$rows) { }
1038 4 8 if @$_ > $nc
1039 0 4 if ($num_cols and $num_cols != $nc) { }
1058 0 6 unless @$linenums == @$rows
1098 1 2 $pkg eq 'main' ? :
1109 0 3 if (@_ > 0 and %$tiedvarnames)
1112 0 0 unless exists $$tiedvarnames{$_}
1123 16 0 defined $cx ? :
1129 0 16 unless $ident =~ /^\w+$/u
1131 0 16 if (exists $$tiedvarnames{$ident})
1132 0 0 if $debug
1136 0 16 if $debug
1139 8 8 if ($safe)
1140 0 8 if (${^GLOBAL_PHASE} ne "START")
1141 0 0 unless $silent
1148 0 16 if $debug
1150 0 16 if (exists ${$p . "::";}{$ident})
1170 0 0 if (my $r = *$fqname{"SCALAR"})
1171 0 0 if (defined $$r)
1175 0 0 if (my $r = *$fqname{"ARRAY"})
1178 0 0 if (my $r = *$fqname{"HASH"})
1181 0 0 if (my $r = *$fqname{"CODE"})
1184 0 0 if (my $r = *$fqname{"IO"})
1187 0 0 if (eval {
1190 0 0 unless /^(.+)\.(.*)$/u
1191 0 0 if (grep {$_ eq $ident;} $obj->$methname)
1201 0 16 if $debug
1227 0 18 if (/^(?:REGERROR|REGMARK|AUTOLOAD)$/u)
1241 0 3 unless @_
1251 5 0 if (/:/u) { }
1253 0 0 unless /^\$?\w+$/u
1273 0 3 if exists $$opts{"title_rx"}
1275 3 0 if (delete $tokens{":all"})
1281 0 3 if %tokens
1285 0 3 $r == 1 ? :
1288 0 3 if $$$self{"verbose"}
1300 274 0 if (@_ == 0)
1301 0 274 if $$$self{"verbose"}
1304 0 0 if $$$self{"verbose"}
1305 0 0 unless @_ == 1
1323 0 0 unless exists $${$self;}{"input_iolayers"} and $${$self;}{"input_iolayers"} =~ /encoding\(([^()]*)\)/u
1331 0 0 defined $title_rx ? :
1332 0 0 if $$$self{"verbose"}
1348 0 0 if $rx < 0 or $rx > $#$rows
1351 0 0 if not defined $cx or $cx < 0 or $cx > $#$row
1370 0 12 if defined $sheet and not &blessed($sheet) && $sheet->isa('Spreadsheet::Edit')
1387 0 0 $in_midst ? :
1394 0 0 unless defined $sheet
1398 0 0 if (length $desc > $trunclen)
1404 0 0 unless $${$_[0];}{"verbose"}
1410 0 8 if @_ > 3
1411 8 0 unless $${$_[0];}{"verbose"}
1419 0 6 if (@$cxlist) { }
1439 0 6 unless ref $code eq "CODE"
1442 0 0 if ($_ < 0 or $_ >= $num_cols)
1453 5 1 if (defined $rxlist) { }
1455 0 5 if $rx < 0 or $rx > $#$rows
1475 0 6 if defined $$hash{"current_rx"} and $$hash{"current_rx"} > $#$rows
1588 0 0 unless @$old_colxs == $num_cols
1592 0 0 if defined $old_cx
1597 0 0 unless defined $cx
1598 0 0 if (defined(my $new_cx = $old2new{$cx})) { }
1599 0 0 if $debug
1602 0 0 if $debug
1620 0 0 unless defined $spec
1621 0 0 if ($spec eq "^")
1625 0 0 if ($spec eq "\$")
1629 0 0 if ($spec =~ /^[1-9]\d*$/u || $spec eq '0' and $spec <= $num_cols)
1634 0 0 if (defined(my $cx = $$colx{$spec}))
1638 0 0 if (ref $spec eq "Regexp")
1640 0 0 unless defined $title_rx
1648 0 0 if ($title =~ /$spec/u)
1653 0 0 unless ($matched)
1666 0 0 unless wantarray
1672 0 0 if (@list > 1)
1681 0 0 if ref $colspec eq "Regexp"
1708 0 0 if ($spec =~ /^>(.*)/u)
1717 0 0 ref $_[0] eq 'HASH' ? :
1718 0 0 if ($opthash)
1722 0 0 unless scalar @_ % 2 == 0
1735 0 0 if (my $wheredefined = $$useraliases{$ident})
1743 0 0 if $$useraliases{$ident}
1746 0 0 unless (defined $cx)
1747 0 0 unless $@
1748 0 0 unless $$opthash{"optional"} and $@ =~ /does not match/isu
1767 0 0 if ref $_[0] eq "HASH"
1819 2 6 if (@_ == 0) { }
1821 0 2 if %$opthash
1828 1 5 if &u($_[0]) eq "_notie"
1829 0 6 if @_
1831 6 0 if (defined $rx)
1832 1 5 if ($rx eq 'auto') { }
0 5 elsif (not $rx =~ /^\d+$/u) { }
0 5 elsif ($rx > $#{$$$self{'rows'};}) { }
1855 0 1 if ($#$rows == -1)
1861 0 1 $$opthash{'required'} ? :
1862 0 1 if grep {not defined $_;} @required_specs
1867 1 0 if $max_rx > $#$rows
1871 1 0 if $last_cx >= $num_cols
1874 0 1 if ($min_rx > $#$rows) { }
0 1 elsif ($min_rx > $max_rx) { }
1881 0 1 if ($first_cx >= $num_cols) { }
0 1 elsif ($first_cx > $last_cx) { }
1890 1 0 unless (@nd_reasons)
1895 0 1 if $debug and @nd_reasons
1896 0 1 if $debug
1902 0 1 unless $rx == $$$self{"title_rx"}
1906 0 2 if ($$row[$cx] eq "")
1914 0 0 if $debug
1915 0 0 if (@list == 0)
1919 0 0 if $$_[0] >= $first_cx
1921 0 0 if (@shortlist == 0)
1925 0 0 unless (grep {$$_[1] =~ /title/iu;} @shortlist)
1930 0 0 if $debug
1937 1 0 if (defined $detected) { }
1938 0 1 if ($verbose)
1947 0 0 if (@nd_reasons == 0)
1962 0 0 if (@_ == 0)
1969 0 0 if defined $rx
1976 0 0 if (@_ == 0)
1982 0 0 if (defined $rx)
1985 0 0 unless $rx >= ($$$self{"first_data_rx"} // 0)
2009 0 0 if $to_cx + @sources - @source_cxs_before > $num_cols
2039 0 0 if (not defined $title_rx and $have_new_titles)
2045 0 0 if (defined $title_rx and $row == $$rows[$title_rx]) { }
2065 0 0 unless @_ == 1
2071 0 0 defined $title_rx ? :
2077 0 0 unless defined $first_rx
2078 0 0 unless defined $last_rx
2107 0 0 if $cx > $#$row
2125 12 0 unless !!$oldval != !!$val
2126 0 0 if ($key eq 'silent') { }
0 0 elsif ($key eq 'verbose') { }
0 0 elsif ($key eq 'debug') { }
2130 0 0 if ($val) { }
2138 0 0 if ($val) { }
2158 0 0 exists $$$self{$_} ? :
2162 0 0 if (@_ == 0) { }
2163 0 0 unless wantarray
2175 0 0 unless @_ == 2
2180 0 0 if ($seen{$cx})
2224 0 0 ref $separator eq 'CODE' ? :
2241 0 0 unless scalar @_ % 2 == 0
2246 0 0 unless defined $title_rx
2256 0 0 if $cx > $#$title_row
2292 0 0 @cxs > 0 ? :
0 0 if $$$self{"verbose"}
2299 3 2 ref $_ eq 'ARRAY' ? :
2301 5 0 unless ref $_
0 5 unless @$result > 0 and not grep({$_ eq "" unless ref $_;} @$result)
2312 0 5 unless defined $rxlist_arg
2317 0 0 @cxs > 0 ? :
0 5 if $$$self{"verbose"}
2327 0 0 unless defined $exrxlist_arg
2332 0 0 @cxs > 0 ? :
0 0 if $$$self{"verbose"}
2336 0 0 if $_ < 0 or $_ > $max_rx
2358 0 0 if $$$self{"verbose"}
2364 0 0 if $old_cx >= $newcols_first_cx
2375 0 0 if $$$self{"verbose"}
2385 0 0 if $$$self{"verbose"}
2408 0 0 if ($$$self{'saved_linenums'}) { }
2433 0 0 if /^(?:LAST|\$)$/u
2435 0 0 unless $_ <= $#$rows
2438 0 0 if $$$self{"verbose"}
2441 0 0 if (defined $title_rx)
2443 0 0 if ($_ < $title_rx) { }
0 0 elsif ($_ == $title_rx) { }
2446 0 0 if $$$self{"verbose"}
2453 0 0 if (defined $first_data_rx)
2455 0 0 if ($_ <= $first_data_rx)
2459 0 0 if (defined $last_data_rx)
2461 0 0 if ($_ <= $last_data_rx)
2471 0 0 if (defined $current_rx)
2473 0 0 if $_ <= $current_rx
2503 0 0 if $rx =~ /^(?:END|\$)$/u
2506 0 0 if $$$self{"verbose"}
2510 0 0 if (defined $title_rx and $rx <= $title_rx)
2513 0 0 if (defined $first_data_rx and $rx <= $first_data_rx)
2516 0 0 if (defined $last_data_rx and $rx <= $last_data_rx)
2551 0 62 if defined $$opthash{$key}
2557 0 2 if exists $$opthash{"sheet"}
2570 0 2 if (my $enc = delete $$opthash{"encoding"})
2606 0 2 unless my $csv = "Text::CSV"->new(\%csvopts)
2630 0 2 unless close $fh
2642 0 10 if exists $$opthash{$_}
2645 1 1 exists $$opthash{'title_rx'} ? :
2653 0 2 if $$$self{"verbose"}
2662 0 0 ref $_[0] eq 'HASH' ? :
2670 0 0 if defined $$opts{$key}
2679 0 0 if %notok
2685 0 0 unless ($$opts{"iolayers"} =~ /encoding\(|:utf8/u)
2690 0 0 unless ($$opts{"iolayers"} =~ /:(?:crlf|raw)\b/u)
2699 0 0 if (&openhandle($dest)) { }
2702 0 0 if $$$self{"verbose"}
2707 0 0 if $$$self{"verbose"}
2708 0 0 if $dest =~ /\.([a-z]*)$/u and lc $1 ne "csv"
2710 0 0 unless open $fh, ">$dest"
2713 0 0 unless binmode $fh, $$opts{"iolayers"}
2752 0 0 $csvopts{'quote_char'} ne '' ? :
0 0 $csvopts{'escape_char'} ne '' && $csvopts{'escape_char'} ne "\000" ? :
2760 0 0 unless defined $value
2764 0 0 unless ($must_be_quoted)
2765 0 0 if ($value eq '') { }
2766 0 0 if $csvopts{"quote_empty"}
2768 0 0 if ($csvopts{"quote_char"} ne "")
2775 0 0 if $value =~ /\Q$csvopts{"quote_char"}\E/d or $csvopts{"sep_char"} ne "" and $csvopts{"sep_char"} ne "\0" and $value =~ /\Q$csvopts{"sep_char"}\E/d or $csvopts{"escape_char"} ne "" and $csvopts{"escape_char"} ne "\0" and $value =~ /\Q$csvopts{"escape_char"}\E/d or $csvopts{"quote_binary"} and $value =~ /[\x00-\x1f\x7f-\xa0]/d or $csvopts{"quote_space"} and $value =~ /[\x09\x20]/d
2780 0 0 if ($csvopts{"escape_null"})
2783 0 0 if ($must_be_quoted)
2786 0 0 unless $cx == 0
2792 0 0 unless (&openhandle($dest))
2793 0 0 unless close $fh
2806 0 0 if $$$self{"verbose"}
2812 0 0 if (ref $cf eq "HASH")
2815 0 0 if $key eq "__DEFAULT__"
2819 0 0 unless defined $_
2829 0 0 unless close $csvfh
2851 0 7 unless (defined $$$self{"current_rx"})
2854 0 0 if defined $pkg and $pkg->isa("Data::Dumper")
2864 0 9 if $mutating
2866 0 9 unless defined $sheet
2868 5 4 $onlyinapply ? :
2873 0 5 unless exists $$$sheet{$ident}
2882 0 0 if ($index_ident eq "current_rx" or $index_ident eq "title_rx")
2887 0 0 if $index > $#$aref
2892 4 0 if $mutable
2905 0 14 if index($pkg, "Spreadsheet::Edit") >= 0
2906 2 12 $$opthash{'package'} ? :
2909 12 2 if (@_) { }
2911 0 12 if @_
2912 9 3 if (defined $new)
2913 0 9 if $$$new{"cmd_nesting"}
2917 0 0 &u($curr) eq &u($new) ? :
0 12 if $verbose
2926 0 2 if $verbose
2957 0 47 unless $index >= 0 and $index <= $#$aref
2964 0 12 unless $index >= 0 and $index <= $#$aref + 1
2966 0 12 unless &Spreadsheet::Edit::__looks_like_aref($val)
2969 0 12 if grep {not defined $_;} @$val
2971 0 30 if ref $_
0 12 if grep {not &looks_like_number($_) if ref $_;} @$val
2972 0 12 if (my $num_cols = $$$sheet{"num_cols"})
2973 0 0 if @$val != $num_cols
3026 0 4 unless (defined $cx)
3027 0 0 unless exists $$colx{$key}
3032 0 0 if $mutating