Branch Coverage

blib/lib/MP3/Info.pm
Criterion Covered Total %
branch 141 294 47.9


line true false branch
94 0 0 unless my $info = get_mp3info($file)
112 0 0 unless ref $self
114 0 0 if exists $$self{$name}
122 0 0 if (exists $$self{$name}) { }
125 0 0 if (defined $_[1])
133 0 0 exists $MP3::Info::v1_tag_fields{$name} ? :
173 4 0 if ($val == 1) { }
0 0 elsif ($val == 0) { }
174 4 0 if ($unicode_module)
234 0 16 unless (defined $file and $file ne '')
239 0 16 unless (-s $file)
244 0 16 if (ref $file) { }
247 0 16 unless (open $fh, '+<', $file)
255 16 0 if ($version eq 1 or $version eq 'ALL')
258 5 11 if (<$fh> =~ /^TAG/)
259 0 5 unless truncate $fh, $tell
264 16 0 if ($version eq 2 or $version eq 'ALL')
266 6 10 if ($v2h)
280 0 6 unless truncate $fh, $eof - $$v2h{'tag_size'}
325 5 65 defined $_ ? :
329 5 0 if ref $title
332 0 5 if (not $ref) { }
5 0 elsif ($ref eq 'HASH') { }
349 0 5 unless (defined $file and $file ne '')
354 0 5 unless (-s $file)
360 5 0 if $info{'TRACKNUM'}
364 5 0 if ($^W)
367 0 25 unless defined $info{$field}
368 0 25 if (length $info{$field} > $MP3::Info::v1_tag_fields{$field})
374 5 0 if ($info{'GENRE'})
375 0 5 unless exists $MP3::Info::mp3_genres{$info{'GENRE'}}
380 5 0 if ($info{'TRACKNUM'})
382 0 5 unless ($info{'TRACKNUM'} =~ /^\d+$/ and $info{'TRACKNUM'} > 0 and $info{'TRACKNUM'} < 256)
384 0 0 if $^W
390 0 5 if (ref $file) { }
393 0 5 unless (open $fh, '+<', $file)
403 2 3 <$fh> =~ /^TAG/ ? :
406 5 0 $info{'GENRE'} && exists $MP3::Info::mp3_genres{$info{'GENRE'}} ? :
411 5 0 if ($info{'TRACKNUM'}) { }
461 0 0 $ver == 2 || $ver == 1 ? :
14 0 !$ver ? :
463 0 14 unless (defined $file and $file ne '')
468 0 14 unless (-s $file)
473 0 14 if (ref $file) { }
476 0 14 unless (open $fh, '<', $file)
484 14 0 if ($ver < 2)
488 8 6 if ($tag and $tag =~ /^TAG/) { }
0 6 elsif ($ver == 1) { }
490 7 1 if (substr($tag, -3, 2) =~ /\000[^\000]/) { }
502 8 0 if ($UNICODE)
504 0 63 unless $info{$key}
517 0 14 unless ($v1 or $v2)
523 6 8 if ($ver == 0 || $ver == 2 and $v2)
524 0 6 if ($raw_v2 == 1 and $ver == 2) { }
528 0 6 $raw_v2 == 2 ? :
530 36 48 if (exists $$v2{$id})
540 0 36 if (ref $data1 and not $raw_v2)
541 0 0 if ($id =~ /^COMM?$/) { }
549 36 0 unless ref $data1
559 6 30 if ($id =~ /^COM[M ]?$/)
563 36 0 if ($UNICODE) { }
564 0 36 if ($encoding eq "\cA" or $encoding eq "\cB") { }
0 36 elsif ($encoding eq "\cC") { }
36 0 elsif ($encoding eq "\000") { }
586 36 0 if (ref $dec) { }
602 0 0 if ($data =~ s/^\xFF\xFE//) { }
0 0 elsif ($data =~ s/^\xFE\xFF//) { }
607 0 0 if ($pat)
608 0 0 chr($_) =~ /[[:ascii:]]/ && chr($_) =~ /[[:print:]]/ ? :
618 6 30 if ($id =~ /^COM[M ]?$/) { }
6 24 elsif ($id =~ /^TCON?$/) { }
624 6 0 if ($data =~ /^ \(? (\d+) (?:\)|\000)? (.+)?/sx)
626 0 6 if ($name and $name ne "\000") { }
634 0 36 if ($raw_v2 == 2 and $desc)
638 0 36 if ($raw_v2 == 2 and exists $info{$$hash{$id}}) { }
639 0 0 if (ref $info{$$hash{$id}} eq 'ARRAY') { }
650 0 6 if ($ver == 0 and $info{'TAGVERSION'}) { }
658 14 0 unless ($raw_v2 and $ver == 2)
660 105 0 if (defined $info{$key})
667 7 91 unless defined $info{$_}
671 0 14 if (keys %info and exists $info{'GENRE'} and not defined $info{'GENRE'})
677 14 0 keys %info ? :
685 8 6 unless $v2h = _get_v2head($fh)
687 0 6 if ($$v2h{'major_version'} < 2)
688 0 0 if $^W
695 2 4 $$v2h{'major_version'} > 3 ? :
697 2 4 if ($$v2h{'major_version'} == 2) { }
711 0 6 if $$v2h{'unsync'}
715 6 0 unless $bytes =~ /^([A-Z0-9]{$num})/ or $num == 4 and $bytes =~ /^(COM )/
725 12 24 if ($$v2h{'major_version'} > 3)
735 6 36 unless my($id, $size, $flags) = &$myseek
740 0 36 if ($$flags{'data_len_indicator'})
750 0 36 if $$flags{'frame_unsync'} and not $$v2h{'unsync'}
753 0 36 if ($$flags{'data_len_indicator'} and defined $data_len)
754 0 0 unless $data_len == length $bytes
757 0 36 if (exists $$v2{$id}) { }
758 0 0 if (ref $$v2{$id} eq 'ARRAY') { }
812 0 6 unless (defined $file and $file ne '')
817 0 6 unless (-s $file)
822 0 6 if (ref $file) { }
825 0 6 unless (open $fh, '<', $file)
838 6 0 if ($off == 0)
839 0 6 if (my $v2h = _get_v2head($fh))
852 0 1944 if ($off > $tot and not $MP3::Info::try_harder)
858 1878 66 if ord $byte != 255
868 6 0 <$fh> =~ /^TAG/ ? :
6 0 if <$fh> =~ /^TAG/ ? 1 : 0
882 0 0 $$h{'IDR'} == 0 ? :
3 0 $$h{'IDR'} == 3 ? :
3 3 $$h{'IDR'} == 2 ? :
885 0 6 defined $vbr ? :
887 0 6 $$h{'copyright'} ? :
888 0 6 $$h{'padding_bit'} ? :
889 3 3 $$h{'mode'} == 3 ? :
892 0 6 $vbr && $$vbr{'bytes'} ? :
895 3 3 $$h{'ID'} ? :
896 0 6 $vbr && $$vbr{'frames'} ? :
901 0 6 if ($vbr)
902 0 0 if $$vbr{'scale'}
904 0 0 unless ($$h{'bitrate'})
921 6 0 if $$i{'FRAMES'}
949 0 72 unless my $h = $_[0]
995 3 3 if ($$h{'ID'}) { }
996 0 3 $$h{'mode'} == 3 ? :
998 3 0 $$h{'mode'} == 3 ? :
1002 6 0 unless $bytes eq 'Xing'
1007 0 0 if ($vbr{'flags'} & 1)
1012 0 0 if ($vbr{'flags'} & 2)
1017 0 0 if ($vbr{'flags'} & 4)
1023 0 0 if ($vbr{'flags'} & 8) { }
1035 0 36 unless my $fh = $_[0]
1044 0 36 if ($bytes eq 'RIF' or $bytes eq 'FOR')
1045 0 0 unless _find_id3_chunk($fh, $bytes)
1050 24 12 unless $bytes eq 'ID3'
1061 4 8 if ($$v2h{'major_version'} == 2) { }
1070 4 4 if $$v2h{'major_version'} == 4
1075 0 12 if $$v2h{'footer'}
1085 0 12 if ($$v2h{'ext_header'})
1090 0 0 $$v2h{'major_version'} > 3 ? :
1104 0 0 if ($filetype eq 'RIF') { }
0 0 elsif ($filetype eq 'FOR') { }
1105 0 0 if $bytes ne 'F'
1109 0 0 if $bytes ne 'M'
1117 0 0 if $tag eq $mat
1130 41 0 unless (ref $file)
1131 0 41 unless close $fh
1308 36 12 $_ ? :