Branch Coverage

blib/lib/Convert/MRC.pm
Criterion Covered Total %
branch 6 238 2.5


line true false branch
68 5 0 if ($fh)
69 5 0 if (ref $fh eq 'GLOB') { }
73 0 0 unless open my $fh2, '>', $fh
84 5 0 if ($fh)
85 5 0 if (ref $fh eq 'GLOB') { }
89 0 0 unless open my $fh2, '>', $fh
114 5 0 if ($fh)
115 5 0 if (ref $fh eq 'GLOB') { }
0 0 elsif ($fh eq '-') { }
123 0 0 unless open my $fh2, '<', $fh
214 0 0 if $Convert::MRC::INPUT_LINE_NUMBER == 1
217 0 0 if (/^=MRCtermTable/i)
221 0 0 unless $started
223 0 0 if /^\s*$/
225 0 0 unless $row = $self->_parseRow($_)
234 0 0 if ($segment eq 'header' and $$row{'ID'} eq 'A')
235 0 0 unless $self->_buildHeader($self->_parseRow($_), \%header)
240 0 0 if ($segment eq 'header' and $$row{'ID'} ne 'A')
243 0 0 unless ($self->_printHeader(\%header))
255 0 0 if ($segment eq 'body' and exists $$row{'Concept'})
272 0 0 if ($$row{'Concept'} ne $$self{'concept'})
286 0 0 if (exists $$row{'LangSet'} and $$row{'LangSet'} ne $$self{'langSet'})
298 0 0 if (exists $$row{'Term'} and $$row{'Term'} ne $$self{'term'})
313 0 0 if (defined $$row{'Term'}) { }
0 0 elsif (defined $$row{'LangSet'}) { }
0 0 elsif (defined $$row{'Concept'}) { }
317 0 0 if (defined $$self{'term'})
325 0 0 if (defined $$self{'langSet'})
340 0 0 unless ($Convert::MRC::legalIn{$level}{$$row{'DatCat'}})
347 0 0 if $$row{'DatCat'} eq 'definition'
350 0 0 if defined $$row{'Link'}
354 0 0 if ($level eq 'Term') { }
364 0 0 if ($segment eq 'body' and not exists $$row{'Concept'})
375 0 0 if ($segment eq 'back' and exists $$row{'Party'})
378 0 0 if (defined $$self{'party'} and $$row{'Party'} ne $$self{'party'})
385 0 0 if ($$topRow{'DatCat'} eq 'type') { }
401 0 0 if ($$row{'DatCat'} eq 'type') { }
411 0 0 if ($segment eq 'back' and not exists $$row{'Party'})
423 0 0 if ($segment eq 'body')
431 0 0 if ($segment eq 'back')
436 0 0 if ($$topRow{'DatCat'} eq 'type') { }
447 0 0 if (exists $responsible{'person'})
453 0 0 if (exists $responsible{'organization'})
460 0 0 if (exists $responsible{'unknown'})
472 0 0 unless ($started)
484 0 0 if ($segment eq 'header' and not $aborted)
487 0 0 unless ($self->_printHeader(\%header))
500 0 0 if ($aborted)
507 0 0 if @linksMade
510 0 0 if @idsUsed
546 0 0 if (defined $$self{'term'})
556 0 0 unless ($posContext or $$self{'langSetDefined'})
570 0 0 if (defined $$self{'langSet'})
581 0 0 if (defined $$self{'concept'})
607 0 0 unless ($row{'ID'} and $row{'DatCat'} and $row{'Value'})
613 0 0 if ($row{'ID'} =~ /^[Cc] *(\d{3}) *($Convert::MRC::langCode)? *(\d*)$/) { }
0 0 elsif ($row{'ID'} =~ /^[Rr] *(\d{3})$/) { }
0 0 elsif ($row{'ID'} =~ /^[Aa]$/) { }
614 0 0 if ($3 and not $2)
620 0 0 if $2
621 0 0 if $2 and $3 ne ''
624 0 0 if $row{'LangSet'}
625 0 0 if defined $row{'Term'}
643 0 0 if (my $correct = $Convert::MRC::correctCaps{'DatCat'}{lc $row{'DatCat'}}) { }
646 0 0 unless ($row{'DatCat'} eq $correct)
657 0 0 if ($row{'Value'} =~ /^\[($Convert::MRC::langCode)] *(.*)$/)
663 0 0 if ($row{'DatCat'} eq 'termLocation') { }
0 0 elsif ($Convert::MRC::correctCaps{$row{'DatCat'}}) { }
664 0 0 if (my $correct = $Convert::MRC::correctCaps{'termLocation'}{lc $row{'Value'}}) { }
667 0 0 unless ($row{'Value'} eq $correct)
685 0 0 if (my $correct = $caps{lc $row{'Value'}}) { }
686 0 0 unless ($row{'Value'} eq $correct)
702 0 0 if (/^([^:]+): *(?:\[($Convert::MRC::langCode)])? *(.+)$/) { }
705 0 0 if $2
713 0 0 if ($row{$keyword}{'FieldLang'} and not $Convert::MRC::allowed{$keyword}{'FieldLang'})
722 0 0 unless ($Convert::MRC::allowed{$row{'DatCat'}}{$keyword})
725 0 0 if ($keyword eq 'Source' or $keyword eq 'Note')
733 0 0 if ($row{'Date'})
734 0 0 if ($row{'Date'}{'Value'} =~ /^(\d{4})-(\d{2})-(\d{2})$/) { }
735 0 0 if ($1 eq '0000' or $2 eq '00' or $3 eq '00') { }
0 0 elsif ($2 <= $NUM_MONTHS and $3 <= $NUM_MONTHS) { }
0 0 elsif ($2 > $NUM_MONTHS) { }
755 0 0 if ($row{'DatCat'} eq 'transactionType') { }
0 0 elsif ($row{'DatCat'} =~ /^(?:crossReference|externalCrossReference|xGraphic)$/ and not $row{'Link'}) { }
756 0 0 unless $row{'Link'}
774 0 0 unless $destKey = $Convert::MRC::corresp{$$srcRef{'DatCat'}}
778 0 0 if ($destKey eq 'Language' and defined $$destRef{'Language'})
790 0 0 unless defined $$info{'Language'} and defined $$info{'Source'}
804 0 0 if exists $$info{'Subject'} and scalar @{$$info{'Subject'};}
859 0 0 unless (defined $$row{'DatCat'})
865 0 0 if ($datCat eq 'term') { }
0 0 elsif (my $position = $Convert::MRC::position{$datCat}) { }
870 0 0 if ('termGrp' eq $position) { }
0 0 elsif ('auxInfo' eq $position) { }
872 0 0 if $datCat eq 'partOfSpeech'
876 0 0 if $datCat eq 'context'
885 0 0 unless ($term)
890 0 0 unless ($pos)
905 0 0 if (ref $item eq 'HASH') { }
0 0 elsif (ref $item eq 'ARRAY') { }
909 0 0 unless (defined $datCat)
917 0 0 if ($datCat eq 'term') { }
0 0 elsif ($datCat eq 'note') { }
0 0 elsif ($datCat =~ /^(?:source|customerSubset|projectSubset)$/) { }
0 0 elsif ($datCat eq 'transactionType') { }
0 0 elsif ($datCat eq 'crossReference') { }
0 0 elsif ($datCat eq 'externalCrossReference' or $datCat eq 'xGraphic') { }
0 0 elsif ($datCat =~ /^(?:email|title|role|org|uid|tel|adr|fn)$/) { }
0 0 elsif ($Convert::MRC::meta{$datCat} eq 'termNote') { }
939 0 0 if $$item{'Date'}
943 0 0 if $$item{'Note'}
946 0 0 if ($$item{'Responsibility'} or $$item{'Link'})
948 0 0 if $$item{'Link'}
952 0 0 unless $$item{'Responsibility'}{'Value'}
985 0 0 unless $meta = $Convert::MRC::meta{$datCat}
992 0 0 if $$item{'Note'}
995 0 0 if $$item{'Source'}
1005 0 0 if (ref $$item[0] ne 'ARRAY') { }
1014 0 0 if (exists $$termGrp[0]) { }