Branch Coverage

MARC.pm
Criterion Covered Total %
branch 397 650 61.0


line true false branch
28 0 4 unless $MARC::TEST
57 4 1 if $g
68 5 0 if ($file)
69 0 5 unless (-e $file)
73 0 5 unless open *file, $file
78 4 1 if ($format =~ /usmarc$/io) { }
0 1 elsif ($format =~ /unimarc$/io) { }
1 0 elsif ($format =~ /marcmaker$/io) { }
0 0 elsif ($format =~ /xml/io) { }
81 0 4 unless close file
86 0 0 unless close file
91 0 1 unless close file
102 0 5 if $MARC::DEBUG
140 5 12 unless $status
141 1 11 if ($status == -1)
143 1 0 unless $recordcount
146 1 10 if ($status == -2)
148 0 1 unless $recordcount
165 1 4 unless (exists $$marc[0]{'makerchar'})
173 1 14 unless $status
174 2 12 if ($status == -1)
176 1 1 unless $recordcount
211 0 3 unless (-e $file)
216 0 3 unless ($$marc[0]{'format'})
217 0 3 unless open *file, $file
223 1 2 if ($$marc[0]{'format'} =~ /usmarc/io) { }
2 0 elsif ($$marc[0]{'format'} =~ /marcmaker/io) { }
227 0 2 if (exists $$params{'charset'}) { }
231 0 2 unless (exists $$marc[0]{'makerchar'})
240 0 0 if ($$params{'format'} =~ /xml/io) { }
248 0 3 if $MARC::DEBUG
249 2 1 if ($totalrecord == 0)
260 0 3 unless ($$marc[0]{'handle'})
279 0 5 unless ($$marc[0]{'handle'})
283 5 0 if ($increment)
284 3 2 if ($$marc[0]{'format'} =~ /usmarc/io) { }
2 0 elsif ($$marc[0]{'format'} =~ /marcmaker/io) { }
330 0 2 if $tag eq '000'
367 3 0 unless ($field or $subfield)
379 7 5 unless $delrecords{$i}
384 5 11 unless $has_subfield
404 1 1 if ($selelement =~ /(\d+)-(\d+)/) { }
410 0 1 unless ($selarray)
426 0 36 unless ref $template eq 'HASH'
437 15 21 if ($field and not $subfield and not $regex and not $notregex) { }
13 8 elsif ($field and $subfield and not $regex and not $notregex) { }
2 6 elsif ($field and not $subfield and $regex) { }
2 4 elsif ($field and $subfield and $regex) { }
2 2 elsif ($field and not $subfield and $notregex) { }
2 0 elsif ($field and $subfield and $notregex) { }
454 31 45 if ($searchtype eq 'fieldpresence') { }
29 16 elsif ($searchtype eq 'subfieldpresence') { }
4 12 elsif ($searchtype eq 'fieldvalue') { }
4 8 elsif ($searchtype eq 'subfieldvalue') { }
4 4 elsif ($searchtype eq 'fieldnotvalue') { }
4 0 elsif ($searchtype eq 'subfieldnotvalue') { }
455 15 16 unless exists $$marc[$i]{$field}
459 9 20 unless exists $$marc[$i]{$field}
460 6 14 unless exists $$marc[$i]{$field}{$subfield}
464 0 4 unless exists $$marc[$i]{$field}
465 0 4 unless exists $$marc[$i]{$field}{'field'}
469 2 2 if (eval qq["$z" =~ $regex])
471 2 2 if ($flag)
474 0 4 unless exists $$marc[$i]{$field}
475 0 4 unless exists $$marc[$i]{$field}{$subfield}
478 2 2 if (eval qq["$$y" =~ $regex])
480 2 2 if ($flag)
483 0 4 unless exists $$marc[$i]{$field}
484 0 4 unless exists $$marc[$i]{$field}{'field'}
486 0 4 unless ($x)
489 2 2 if (eval qq["$z" =~ $notregex])
491 2 2 unless ($flag)
494 0 4 unless exists $$marc[$i]{$field}
495 0 4 unless exists $$marc[$i]{$field}{$subfield}
497 0 4 unless ($x)
499 2 2 if (eval qq["$$y" =~ $notregex])
501 2 2 unless ($flag)
517 0 0 unless ref $template eq 'HASH'
519 0 0 unless ($record)
520 0 0 if ($record > $#{$marc;})
533 0 63 unless ref $template eq 'HASH'
536 0 63 unless ($record)
537 0 63 if ($record > $#{$marc;})
678 4 27 if $MARC::TEST
693 0 31 if ($args and $$args{'records'})
713 31 8 if $$args{'file'} or $$args{'add_005s'}
715 1 38 unless (exists $$args{'format'})
720 2 37 if ($$args{'format'} =~ /marc$/io) { }
6 31 elsif ($$args{'format'} =~ /marcmaker$/io) { }
6 25 elsif ($$args{'format'} =~ /ascii$/io) { }
8 17 elsif ($$args{'format'} =~ /html$/io) { }
2 15 elsif ($$args{'format'} =~ /html_header$/io) { }
4 11 elsif ($$args{'format'} =~ /html_start$/io) { }
2 9 elsif ($$args{'format'} =~ /html_body$/io) { }
3 6 elsif ($$args{'format'} =~ /html_footer$/io) { }
2 4 elsif ($$args{'format'} =~ /urls$/io) { }
2 2 elsif ($$args{'format'} =~ /isbd$/io) { }
2 0 elsif ($$args{'format'} =~ /xml/io) { }
738 1 3 if ($$args{'title'}) { }
762 0 2 if $^W
765 29 8 if ($$args{'file'}) { }
766 0 29 unless ($$args{'file'} =~ /^>/)
770 0 29 unless open OUT, "$$args{'file'}"
774 0 29 unless close OUT
790 5 31 if exists $$args{'record'}
791 0 36 if $$args{'records'}
793 5 31 if @$trecs
794 31 5 unless @$trecs
960 0 19 unless ($record)
961 0 19 if ($record > $#{$marc;})
963 0 19 unless ($field)
964 0 19 unless ($field =~ /^\d{3}$/)
967 10 9 unless defined $i1
969 10 9 unless defined $i2
971 9 10 if (ref $$params{'value'} eq 'ARRAY')
972 0 19 unless (defined $value[0])
974 19 0 if ($field >= 10)
975 10 9 if ($value[0] eq 'i1')
979 0 19 unless (1 == length $i1)
983 10 9 if ($value[0] eq 'i2')
987 0 19 unless (1 == length $i2)
996 16 3 if ($ordered =~ /y/i)
998 16 233 if ($$marc[$record]{'array'}[$i][0] > $field)
1002 0 233 if ($insertorder == 0)
1006 0 19 if ($field < 10) { }
1008 0 0 if ($ordered =~ /y/i) { }
1019 0 32 if $sub_id eq "\036"
1023 16 3 if ($ordered =~ /y/i) { }
1045 0 0 unless ($record)
1046 0 0 if ($record > $#{$marc;})
1061 0 32 unless ($record)
1062 0 32 if ($record > $#{$marc;})
1064 0 32 unless ($field)
1065 0 32 unless ($field =~ /^\d{3}$/)
1068 698 40 unless $field eq $$fields[0]
1069 5 35 if ($field < 10) { }
1077 0 100 unless defined $subfield
1078 0 100 if (ref $subfield eq 'ARRAY') { }
1111 0 2 unless ($recnum)
1163 0 8 unless ref $template eq 'HASH'
1164 0 8 unless @_
1165 0 8 if defined $$template{'value'}
1168 0 8 unless ($recnum)
1238 0 0 unless ref $template eq 'HASH'
1239 0 0 unless @_
1240 0 0 if defined $$template{'value'}
1243 0 0 unless ($marc->deletemarc($template))
1245 0 0 unless ($y1 eq "\036")
1249 0 0 unless ($marc->addfield($template, @records))
1344 0 592 if $MARC::DEBUG
1351 0 0 unless $MARC::TEST
1372 0 5 if $format eq 'marcmaker'
1389 46 26 if /^(handle|format|proto_rec)$/
1405 0 0 if $$_[0] eq '000'
1428 0 1 if $tag > 10 and not defined $field[3]
1429 0 1 if $tag < 10 and not defined $field[1]
1457 0 113 unless ($field)
1458 0 113 unless ($field =~ /^\d{3}$/)
1465 106 2277 if $$_[0] eq $field and not defined $first
1466 129 2254 if $$_[0] eq $field
1469 7 106 unless defined $first
1491 0 18 unless ref $template eq 'HASH'
1492 0 18 if defined $$template{'value'}
1498 0 18 if (defined $subfield and $subfield =~ /^i[12]$/)
1504 4 14 unless scalar @fieldrefs
1506 12 2 if ($field and not $subfield)
1509 0 12 if $do_rebuild_map
1519 1 1 if ($marcrec->getmatch($subfield, $fieldref))
1525 1 1 unless ($rvictim)
1526 0 1 if $do_rebuild_map
1535 0 1 if ($marcrec->field_is_empty($rvictim))
1541 0 1 if $do_rebuild_map
1547 3 167 unless ref $template eq 'HASH'
1569 16 280 if ($tag eq '000')
1571 64 216 if ($tag < 10) { }
1617 0 373 if $MARC::DEBUG
1618 95 278 if ($tag < 10) { }
1643 6 18 unless (exists $$args{'charset'})
1644 5 1 unless (exists $$proto_rec{'brkrchar'})
1655 0 476 if $MARC::DEBUG
1656 24 452 if ($tag eq '000') { }
100 352 elsif ($tag < 10) { }
1685 8 16 if ($$args{'nolinebreak'})
1692 302 42 if (length $outline < 66) { }
1700 2032 244 if (length($outline2) + length($word) < 66) { }
1801 0 5 if ($MARC::DEBUG)
1825 16 4 if scalar @tags
1826 0 20 if (defined $$args{'fields'})
1827 0 0 if ($$args{'fields'} =~ /all$/io)
1834 4 16 if $outputall
1842 106 344 if $tags{$$rfield[0]}
1864 4 86 if ($$rfield[0] eq '001') { }
2 84 elsif ($$rfield[0] eq '856') { }
1869 2 8 if ($$rfield[$k] eq 'u')
1897 6 6 if $tagfields{$_}
1899 0 4 if ($tagfields{'440'})
1905 0 4 if ($tagfields{'490'})
1906 0 0 unless $tagfields{'440'}
1915 0 4 if ($tagfields{'020'})
1949 0 0 unless ($$marcrec{'handle'})
1953 0 0 if ($$marcrec{'format'} =~ /usmarc/io) { }
0 0 elsif ($$marcrec{'format'} =~ /marcmaker/io) { }
1972 0 460 if $tag eq '000'
1976 365 95 if ($tag > 10)
2000 0 7 if $tag eq '000'
2036 0 17 if $string
2037 17 0 if $handle and not defined $string
2041 5 12 unless $line
2042 11 1 if ($recordlength =~ /\d{5}/o) { }
2043 0 11 if $MARC::DEBUG
2045 1 10 unless $recordlength == $octets
2059 45 170 if ($tag < 10) { }
2070 170 280 unless $delim
2091 0 15 unless (exists $$marcrec{'makerchar'})
2103 0 15 if $string
2104 15 0 if $handle and not defined $string
2106 1 14 unless $record
2110 2 12 unless ($leader =~ /^=LDR /o)
2127 48 166 if ($tag < 10) { }
2142 166 329 unless $delim
2149 0 214 if $MARC::DEBUG
2160 186 3 if (exists ${$charmap;}{$1}) { }
2250 0 1 if ($MARC::DEBUG)
2275 0 95 unless ref $template eq 'HASH'
2276 0 95 unless @_
2277 0 95 if defined $$template{'value'}
2288 0 95 unless ($field)
2293 91 4 if ($field and not $subfield)
2296 89 2 if (defined $fieldrefs[0])
2302 87 4 if ($field < 10)
2306 0 91 unless (scalar @fieldrefs)
2319 4 0 if ($field and $subfield)
2320 1 3 if ($field < 10)
2327 1 6 if ($rval)
2337 0 3 if (not $rvictim and $subfield =~ /^i[12]$/)
2343 0 3 if $subfield eq 'i1'
2344 0 3 if $subfield eq 'i2'
2348 3 2 if ($sub eq $subfield)
2353 0 3 unless defined $usub
2358 0 3 unless (scalar @fieldrefs)
2366 2 0 if (not $rvictim and scalar @fieldrefs)
2370 0 2 if $do_rebuild_map
2375 1 0 if ($rvictim)
2384 0 1 if $do_rebuild_map
2418 101 2081 if $$_[0] eq $tag and not defined $first
2419 120 2062 if $$_[0] eq $tag
2420 103 2079 if $$_[0] >= $tag and not defined $firstpast
2423 101 2 if defined $first
2424 0 103 unless defined $firstpast
2425 101 2 if defined $first
2426 2 101 unless $insertpos
2428 0 103 if $do_rebuild_map
2441 0 0 if $$args{'file'} or $$args{'add_005s'}
2443 0 0 unless (exists $$args{'format'})
2448 0 0 if ($$args{'format'} =~ /marc$/io) { }
0 0 elsif ($$args{'format'} =~ /marcmaker$/io) { }
0 0 elsif ($$args{'format'} =~ /ascii$/io) { }
0 0 elsif ($$args{'format'} =~ /html$/io) { }
0 0 elsif ($$args{'format'} =~ /html_header$/io) { }
0 0 elsif ($$args{'format'} =~ /html_start$/io) { }
0 0 elsif ($$args{'format'} =~ /html_body$/io) { }
0 0 elsif ($$args{'format'} =~ /html_footer$/io) { }
0 0 elsif ($$args{'format'} =~ /urls$/io) { }
0 0 elsif ($$args{'format'} =~ /isbd$/io) { }
0 0 elsif ($$args{'format'} =~ /xml/io) { }
2464 0 0 if ($$args{'title'}) { }
2485 0 0 if $^W
2488 0 0 if ($$args{'file'}) { }
2489 0 0 unless ($$args{'file'} =~ /^>/)
2493 0 0 unless open OUT, $$args{'file'}
2497 0 0 unless close OUT
2524 38 125 if $field < 10
2526 2 123 if ($delim)
2535 225 0 unless $result =~ / $/
2551 0 9 if ($tag < 10)
2552 0 9 if $subf eq 'i1'
2553 0 9 if $subf eq 'i2'
2556 2 9 if $$rfield[$i] eq $subf
2574 0 1 if ($tag < 10)
2576 0 1 if ($subf =~ /i[12]/)
2579 1 1 if $$rfield[$i] eq $subf
2599 0 2 if ($tag < 10)
2601 0 2 if ($subf =~ /i[12]/)
2604 0 3 if $$rfield[$i] gt $subf
2619 0 2 unless ref $template eq 'HASH'
2623 0 2 if $$template{'subfield'}
2625 0 2 unless ($field)
2626 0 2 unless ($field =~ /^\d{3}$/)
2628 0 2 unless @fieldrefs
2629 2 0 if ($field and not $subfield) { }
0 0 elsif ($field and $subfield) { }
2632 0 0 if ($field < 10)
2633 0 0 if $subfield eq 'i12'
2637 0 0 if $rsubf
2639 0 0 unless $rsubf
2649 0 63 unless ref $template eq 'HASH'
2653 0 63 unless ($field)
2654 0 63 unless ($field =~ /^\d{3}$/)
2658 25 38 if ($field and not $subfield) { }
38 0 elsif ($field and $subfield) { }
2659 5 20 unless exists $$marcrec{$field}
2660 3 17 if ($field eq '000')
2668 0 38 unless exists $$marcrec{$field}
2669 4 34 unless exists $$marcrec{$field}{$subfield}
2670 10 19 if ($subfield eq 'i1' or $subfield eq 'i2' or $subfield eq 'i12')
2673 5 14 if ($subfield eq 'i1') { }
5 9 elsif ($subfield eq 'i2') { }
2737 0 0 unless exists $$marcrec{'unp_ldr'}
2748 0 4 unless exists $$marcrec{'unp_ldr'}
2786 0 5 unless $type =~ /[abcdefgijkmprot]/ and $bib_lvl eq '' || $bib_lvl =~ /[abcdms]/
2791 0 0 if $type eq 'a' and not $bib_lvl =~ /[bs]/ or $type eq 't' or $type eq 'b'
2797 0 0 if $type eq 'a' and $bib_lvl =~ /[bs]/
2801 0 0 if $type =~ /m/
2802 0 0 if $type =~ /[ef]/
2803 0 0 if $type =~ /[cdij]/
2804 0 0 if $type =~ /[gkro]/
2805 0 0 if $type =~ /p/
2828 0 2 if ($bib_format =~ /UNKNOWN/)
2846 0 1 unless exists $$marcrec{'unp_008'}
2860 0 1 unless $rhff
2896 5 16 if ($tag < 10)
2925 0 21 if /^\s*$/
2927 5 16 if ($tag < 10)
2935 16 0 if $subfields[0] eq ''
2939 0 1 if $do_rebuild_map