Branch Coverage

blib/lib/MMapDB.pm
Criterion Covered Total %
branch 99 282 35.1


line true false branch
113 16 3327 if ($pos + length($pstr) > length $$map)
118 16 0 if sysseek $fh, $need, 0 and truncate $fh, $need
122 0 16 if $@
131 0 7 unless $fmt
134 0 7 unless exists $allowed{$fmt}
139 6 1 if ($I->dbformat_in > 0) { }
146 6 1 if ($I->dbformat_out > 0) { }
160 0 1 if (ref $parent) { }
166 0 0 if (defined $I->_data)
181 0 1 if (@param == 1) { }
185 1 0 if $k = $I->can($k)
187 0 1 unless $I->intfmt eq 'N'
196 0 0 unless $I->_data
208 0 4 if defined $I->_tmpfh
211 0 4 unless $retry--
214 2 2 if defined $I->_data and substr(${$I->_data;}, 4, 1) ne $I->intfmt
216 4 0 unless ($I->_data)
219 0 4 if ($I->readonly) { }
220 0 0 unless open $fh, '<', $I->filename
222 1 3 unless open $fh, '+<', $I->filename
231 0 3 if $@
232 0 3 unless length $dummy
235 0 3 unless exists $dbformats{substr $dummy, 0, 4}
241 0 3 if ($fmt eq "\000")
245 0 3 unless $I->set_intfmt($fmt)
272 0 4 if defined $I->_tmpfh
274 1 3 unless defined $I->_data
290 0 0 unless $data and defined $pos
294 0 0 if $nth > $nrecords
304 0 0 if (@_)
306 0 0 if ($_[$i] == 0) { }
0 0 elsif ($_[$i] == 1) { }
0 0 elsif ($_[$i] == 2) { }
309 0 0 unless $pos + 2 * $isz <= $nth and $nth <= $end
312 0 0 unless defined wantarray
320 0 0 if $cur >= $end
324 0 0 if ($dbfmt > 0) { }
326 0 0 if $utf8
334 0 0 wantarray ? :
341 0 0 unless $data
352 0 0 if (@_)
354 0 0 if ($_[$i] == 0) { }
0 0 elsif ($_[$i] == 1) { }
0 0 elsif ($_[$i] == 2) { }
357 0 0 unless $pos + $isz <= $nth and $nth <= $end
360 0 0 unless defined wantarray
368 0 0 if $cur >= $end
375 0 0 wantarray ? :
392 0 1520 unless $_[0]->_tmpfh
397 0 3 if defined $I->_tmpfh
399 0 3 if $I->readonly
401 0 3 if (defined $I->lockfile)
403 0 0 unless (ref $I->lockfile)
404 0 0 unless open my $fh, '>', $I->lockfile
407 0 0 unless flock $I->lockfile, 2
410 0 3 if (defined $dbfmt)
411 0 0 $dbfmt == -1 ? :
419 0 3 unless open my $fh, '+>', $I->_tmpname . '.strings'
423 3 0 if sysseek $fh, $I->stringmap_prealloc, 0 and truncate $fh, $I->stringmap_prealloc
427 0 3 if $@
433 0 3 unless open my $fh, '+>', $I->_tmpname
449 2 1 if ($I->_data) { }
468 3 1258 if $pos >= $end
479 0 1258 unless $valid
498 498 25 if (ref $v eq 'ARRAY')
500 59 439 if @$v > $recordlen
524 25 498 if (ref $v eq 'HASH') { }
536 1258 0 if ($dbfmt > 0) { }
538 0 1258 if $utf8
558 523 0 if ($dbfmt > 0) { }
560 0 523 if $utf8
586 25 975 unless exists $$m{$k}
589 0 1258 unless ref $m eq 'HASH'
590 498 760 unless defined $$m{$k[0]}
591 0 1258 unless ref $$m{$k[0]} eq 'ARRAY'
630 0 3 if $I->readonly
631 1 2 unless defined $I->_data
658 1 2 if ($need > length $$map)
660 1 0 if sysseek $fh, $need, 0 and truncate $fh, $need
664 0 1 if $@
676 0 3 unless close $I->_stringfh
681 0 3 unless close $fh
685 0 3 unless rename $I->_tmpname, $I->filename
687 3 0 unless $dont_invalidate
689 0 3 if ($I->lockfile)
690 0 0 unless flock $I->lockfile, 8
714 0 0 if ($I->lockfile)
715 0 0 unless flock $I->lockfile, 8
722 0 0 unless defined $I->_tmpfh
729 0 1 if defined $I->_tmpfh
738 0 0 defined $fn ? :
748 0 0 unless defined $fn
751 0 0 unless rename $fn, $I->filename
776 0 5548 if $dbfmt == 0
787 48535 0 if ($dbfmt > 0) { }
789 0 48535 if $utf8
795 29982 18553 if ($rel < 0) { }
16064 2489 elsif ($rel > 0) { }
813 3059 0 if ($dbfmt > 0) { }
814 0 3059 if (&Encode::is_utf8($key)) { }
823 10 3049 if ($pos + length($newstr) > length $$strings)
829 10 0 if sysseek $fh, $need, 0 and truncate $fh, $need
833 0 10 if $@
850 0 1516 unless ref $$rec[0]
852 0 3032 unless defined $v
858 258 1258 if (defined $id) { }
859 0 258 if exists $$idmap{$id}
866 0 1258 if $nid == 0
868 0 0 if $nid == 0
869 0 0 if $nid == $id
890 0 0 unless exists $I->_idmap->{$id}
896 0 0 unless defined($pos = delete $$idmap{$id})
901 0 0 unless $valid
902 0 0 unless $id == $elid
905 0 0 if ($return_element)
910 0 0 if ($dbfmt > 0) { }
912 0 0 if $utf8
970 1 2 unless $I->_data
977 0 260 if @_
978 2 258 if $pos >= $end
985 258 0 if ($valid xor $show_invalid)
1043 0 6 unless defined $param[2]
1070 0 0 if ($ll == 0 and $sh = $$el{$key}) { }
0 0 elsif ($ll == 1) { }
0 0 elsif ($ll == 2) { }
1079 0 0 if (--$$sh[0]) { }
1124 0 0 if $shel = $$I[4] and keys %$shel and $shel = $$shel{$key}
1132 0 0 unless @el
1136 0 0 if (@el == 1 and $el[0] >= $$I[0]->mainidx) { }
1148 0 0 $$I[0]->index_lookup($$I[1], $key) ? :
1154 0 0 @el ? :
1160 0 0 @el ? :
1165 0 0 defined $$I[1] ? :
1167 0 0 $n == 0 ? :
1185 0 0 if $shel = $_[0][4] and keys %$shel and $shel = $$shel{$_[1]}
1191 0 0 if ($_[0][2] == 1) { }
1200 0 0 $$I[0]->id_index_lookup($key) ? :
1206 0 0 @el ? :
1226 0 0 if $shel = $$I[4] and keys %$shel and $shel = $$shel{$idx}
1232 0 0 unless @{$$I[1];} > $idx
1233 0 0 if ($$I[2] == 1) { }