Branch Coverage

lib/Tie/File.pm
Criterion Covered Total %
branch 350 458 76.4


line true false branch
20 0 2985 if (@_ % 2 != 0)
27 0 57 unless ($good_opt{$key})
31 0 57 if ($key =~ s/^-+//)
36 0 2985 if ($opts{'concurrent'})
40 2981 4 unless (defined $opts{'memory'})
45 0 2981 if defined $opts{'dw_size'} and $opts{'dw_size'} > $DEFAULT_MEMORY_SIZE
48 2984 1 unless defined $opts{'dw_size'}
49 0 2985 if ($opts{'dw_size'} > $opts{'memory'})
53 2985 0 unless defined $opts{'defer'}
62 2968 17 unless defined $opts{'autodefer'}
66 2985 0 unless defined $opts{'autodefer_threshhold'}
68 2985 0 unless defined $opts{'autodefer_filelen_threshhold'}
72 2972 13 unless (defined $opts{'recsep'})
76 0 2985 if ($opts{'recseplen'} == 0)
80 2966 19 unless defined $opts{'autochomp'}
82 2982 3 unless defined $opts{'mode'}
88 2 2983 if (UNIVERSAL::isa($file, 'GLOB')) { }
0 2983 elsif (ref $file) { }
93 1 1 unless (seek $file, 1, 0)
102 0 2983 if ($] < 5.006)
107 0 2983 unless sysopen $fh, $file, $opts{'mode'}, 438
112 0 2984 if (defined $opts{'discipline'} and $] >= 5.006)
115 0 0 if $@ =~ /unknown discipline/i
116 0 0 if $@
128 8 987 if exists $self->{'deferred'}{$n}
129 987 8 unless defined $rec
133 695 290 if defined $rec and $self->{'autochomp'}
140 97 47 unless $self->{'autochomp'}
141 47 0 if ($self->{'autochomp'})
143 0 65 unless defined $_
152 25 217 unless $self->{'autochomp'}
153 82 135 unless defined $rec
163 596 1157 if defined $cached
166 22 1135 if ($#{$$self{'offsets'};} < $n)
167 12 10 if $self->{'eof'}
170 6 4 unless defined $o
189 1107 32 if defined $rec and not $self->{'flushing'}
195 0 330 if $DIAGNOSTIC
199 190 140 if ($self->{'autodefer'})
203 71 259 if $self->_is_deferring
212 40 219 unless (defined $oldrec)
231 68 5 if (defined $self->{'deferred_max'} and $n > $self->{'deferred_max'})
237 2 71 if defined $old_deferred
240 1 72 if ($self->{'deferred_s'} > $self->{'dw_size'}) { }
2 70 elsif ($self->_cache_too_full) { }
252 2 4 unless defined $rec
254 4 0 if (defined $self->{'deferred_max'} and $n == $self->{'deferred_max'})
265 508 22 $self->{'eof'} ? :
268 3 527 if defined $top_deferred and $n < $top_deferred + 1
275 15 1 if ($self->{'autodefer'})
280 0 16 if $len == $olen
283 6 10 if ($len > $olen)
284 1 5 if ($self->_is_deferring) { }
295 2 8 if ($self->_is_deferring)
325 1 2 if $size == 0
344 21 10 if ($self->{'autodefer'})
362 2 26 if $self->_is_deferring
371 4 5 if ($self->{'autodefer'})
377 4 5 if $self->_is_deferring
378 4 5 if ($n == $lastrec) { }
4 1 elsif ($n < $lastrec) { }
396 1 10 if exists $self->{'deferred'}{$n}
403 334 54 if ($self->{'autodefer'})
407 1 387 if $self->_is_deferring
408 144 244 if (wantarray) { }
418 2 2982 if $self->_is_deferring
419 2984 0 if defined $self->{'cache'}
420 2983 1 if ($self->{'fh'} and $self->{'ourfh'})
430 7 381 unless defined $pos
436 15 373 unless defined $nrecs
439 73 315 if ($pos < 0)
441 2 71 if ($pos < 0)
447 14 372 if ($pos > $oldsize)
448 6 8 unless @data
453 10 370 if ($nrecs < 0)
455 4 6 if $nrecs < 0
460 32 348 if ($nrecs + $pos > $oldsize)
472 0 507 unless defined $self->_fill_offsets_to($_)
474 0 507 unless defined $rec
484 507 0 if defined $self->{'offsets'}[$_ + 1]
502 191 316 if (defined $new) { }
526 145 92 @result ? :
143 237 wantarray ? :
540 0 179 unless (defined $pos)
546 30 149 if ($len_diff == 0)
579 71 78 if $len_diff < 0
596 0 101 if $c < 0
598 0 101 if $e < $s
619 0 2913 unless @_ % 3 == 0
631 4240 857 if ($len >= $dlen) { }
645 885 4212 if ($delta == 0) { }
3368 844 elsif ($delta < 0) { }
649 1263 2105 if (@_) { }
657 346 498 if (@_) { }
675 0 3422 if ($dpos > $spos) { }
16 3406 elsif ($dpos == $spos) { }
682 771 1091 $len > $blocksize ? :
6100 1862 !defined($len) ? :
690 2119 5843 if ($data eq '')
697 1862 3981 if defined $len
713 375 493 $len > $blocksize ? :
1477 868 !defined($len) ? :
720 677 1668 if ($last_read_was_short) { }
728 5 2340 if $writable eq ''
731 672 1668 if $last_read_was_short and $data eq ''
732 868 800 if defined $len
775 10 812 if $i + 1 > $#{$$self{'offsets'};}
799 562 100 if ($delta)
807 0 662 unless @{$self->{'offsets'};}
822 5 777 unless defined $_
824 776 6 unless substr($_, -$self->{'recseplen'}) eq $self->{'recsep'}
844 0 1283 unless defined $o
846 0 1283 unless seek $self->{'fh'}, $o, 0
853 0 26870 unless seek $self->{'fh'}, $b, 0
862 932 17 if $self->{'eof'}
871 14 13 if (defined $rec) { }
908 0 15049 unless print $fh $rec
920 67 1287 unless defined $rec
921 7 1280 if (substr($rec, -$self->{'recseplen'}) ne $self->{'recsep'})
926 4 3 unless ($self->{'rdonly'})
997 71 78 if $n <= 0
999 56 22 if $n & 8191
1011 0 2 unless (@_ <= 3)
1016 1 1 unless defined $op
1019 1 1 if ($locked and $op & 3)
1034 2 2 if (@_) { }
1047 4 18 if ($#{$$self{'offsets'};} < $n)
1048 3 1 if $self->{'eof'}
1051 1 0 unless defined $o
1119 10 15 unless (defined $end)
1160 4368 147 unless $self->{'defer'}
1166 529 1 if defined $self->{'deferred_max'}
1169 1 0 if $key > $max
1183 2 0 if (@_) { }
1186 1 1 if ($old)
1221 0 564 unless $self->{'autodefer'}
1222 66 498 if $self->{'defer'}
1223 473 25 unless $self->{'offsets'}[-1] >= $self->{'autodefer_filelen_threshhold'}
1226 2 23 if ($n eq 'CLEAR') { }
23 0 elsif ($n =~ /^\d+$/) { }
1230 1 22 if (@H == 0) { }
1233 19 3 if ($H[1] == $n - 1) { }
1235 16 3 if ($H[1] - $H[0] + 1 >= $self->{'autodefer_threshhold'})
1252 5 23 if ($self->{'autodeferring'})
1267 0 2996 if ($^O eq 'MSWin32')
1299 0 380 if (not defined $rs) { }
0 380 elsif ($rs eq '') { }
0 380 elsif ($rsl != length $rs) { }
1311 0 380 if (not defined $self->{'offsets'}[0]) { }
0 380 elsif ($self->{'offsets'}[0] != 0) { }
1332 0 2132 if (defined $offset and $offset != $ao)
1336 0 938 if (defined $cached and $_ ne $cached and not $self->{'deferred'}{$n})
1340 0 2132 if (defined $cached and substr($cached, -$rsl) ne $rs)
1344 0 12 if (not defined $offset and $self->{'eof'})
1350 0 380 if (@{$self->{'offsets'};} > $. + 1)
1360 938 0 if $n + 1 <= $.
1365 0 380 if ($cached != $b)
1372 0 380 unless $self->{'cache'}->_check_integrity
1376 0 380 if (not $self->_is_deferring and %{$self->{'deferred'};})
1385 0 87 if (defined $self->{'cache'}->_produce($n))
1389 0 87 if (substr($r, -$rsl) ne $rs)
1396 0 380 if ($deferred_s != $self->{'deferred_s'})
1402 0 380 if ($deferred_s > $self->{'dw_size'})
1409 0 380 if ($deferred_s + $cached > $self->{'memory'})
1417 0 380 if (not $self->{'autodefer'} and @{$self->{'ad_history'};})
1421 0 9 if ($self->{'autodeferring'} and $self->{'defer'})
1425 366 14 if (@{$self->{'ad_history'};} == 0) { }
14 0 elsif (@{$self->{'ad_history'};} == 2) { }
1429 0 14 if (@non_number) { }
0 14 elsif ($self->{'ad_history'}[1] < $self->{'ad_history'}[0]) { }
1470 0 2986 unless defined $max
1495 3071 430 if (defined $n) { }
1505 0 1177 unless defined $key
1506 0 1177 unless (defined $self->[2])
1509 0 1177 unless defined $val
1510 83 1094 if length $val > $self->[2]
1518 0 1094 if (defined $oldnode) { }
1525 21 1073 if $self->[3] > $self->[2]
1531 6 50 unless defined $old_data
1548 99 336 unless exists $self->[1]{$key}
1559 0 1780 unless defined $key
1569 621 1159 if (exists $self->[1]{$key}) { }
1580 1281 1923 unless defined $loc
1608 0 461 unless defined $key
1609 21 440 if (length $val > $self->[2]) { }
405 35 elsif (exists $self->[1]{$key}) { }
1611 0 21 if defined $oldval
1615 405 0 if defined $oldval
1628 0 381 unless defined $nkeys
1629 0 381 unless @$nkeys == @$okeys
1660 0 44 unless defined $old_data
1670 36 446 if $self->[3] > $self->[2]
1686 0 406 unless $self->[0]->_check_integrity
1691 0 1063 if ($k ne '0' and not $k =~ /^[1-9][0-9]*$/)
1697 0 1063 if (not defined $h) { }
0 1063 elsif ($h == 0) { }
1705 0 1063 if (not defined $j) { }
1710 0 1063 if ($k ne $j->[1])
1719 0 406 if ($bytes != $self->[3])
1725 0 406 if ($bytes > $self->[2])
1754 0 2986 unless eval { do { $cache->can('_heap_move') } }
1809 1129 0 unless defined $seq
1828 0 0 unless defined $i
1830 0 0 if ($self->[$i][0] > $item->[0])
1836 0 0 unless defined $$self[2 * $i]
1837 0 0 unless defined $$self[2 * $i + 1]
1838 0 0 unless defined $dir
1852 0 436 unless defined $i
1854 6 430 unless defined $top
1861 430 482 unless defined $self->[$L] or defined $self->[$R]
1862 131 351 unless defined $self->[$L]
1863 193 289 unless defined $self->[$R]
1864 158 324 unless (defined $ii)
1865 112 46 $self->[$L][0] < $self->[$R][0] ? :
1894 1031 730 unless defined $self->[$L] or defined $self->[$R]
1895 89 641 unless defined $self->[$L]
1896 188 542 unless defined $self->[$R]
1897 453 277 unless (defined $dir)
1898 278 175 $self->[$L][0] < $self->[$R][0] ? :
1902 1460 0 if defined $self->[$_]
1950 0 406 unless (eval { do { $self->[0][1]->isa('Tie::File::Cache') } })
1954 0 406 unless $self->_satisfies_heap_condition(1)
1957 0 1933 if (defined $self->[$i] and not defined $self->[$p])
1962 824 1109 if (defined $self->[$i])
1963 0 824 if ($seq{$self->[$i][0]}) { }
1982 1636 824 unless defined $self->[$c]
1983 0 824 if ($self->[$n][0] >= $self->[$c])
1987 0 824 unless $self->_satisfies_heap_condition($c)
2002 4 3 unless defined $self->[$i]