Branch Coverage

blib/lib/CDDB.pm
Criterion Covered Total %
branch 111 210 52.8


line true false branch
13 0 1 if ($^O eq 'MSWin32') { }
74 3 13 unless ($$self{'handle'})
75 0 3 unless $self->connect
82 16 0 unless $^O eq 'MacOS'
83 0 16 unless syswrite($$self{'handle'}, $str, $len) == $len
95 106 23 if (@{$$self{'lines'};})
102 0 23 unless defined $socket
105 0 23 unless defined $fd
116 0 23 unless select my $rout = $rin, undef, undef, $timeout
117 0 23 unless defined sysread($socket, my $buf = '', 1024)
121 20 3 length $buf == 0 || substr($buf, -1, 1) eq "\n" ? :
148 0 19 unless defined $str
151 0 19 unless ($code, $text) = $str =~ /^(\d+)\s*(.*?)\s*$/
179 154 0 unless $$self{'debug'}
196 0 110 unless my $line = $self->getline
197 6 104 if $line =~ /^\.$/
217 1 0 unless (defined $login)
227 0 1 unless $login = getpwuid $>
237 0 1 unless defined $debug
241 0 1 unless defined $host
245 0 1 unless $port
249 0 1 unless defined $submit_to
253 1 0 unless defined $client_name
257 1 0 unless defined $client_version
261 1 0 unless defined $utf8
262 1 0 if ($utf8)
267 0 1 if ($@)
273 0 1 unless $utf8
277 1 0 $utf8 ? :
1 0 unless defined $cddb_protocol
278 0 1 if $utf8 and $cddb_protocol < 6
314 3 0 if ($$self{'handle'}) { }
337 0 3 unless (defined $$self{'hostname'})
338 0 0 unless $$self{'hostname'} = &hostname()
371 1 3 unless (defined $$self{'handle'})
381 0 1 if ++$cddbp_host_selector > @cddbp_hosts
398 0 3 unless (defined $$self{'handle'})
400 0 0 unless $$self{'debug'}
410 0 3 if ($code != 2)
425 0 3 if ($code == 4)
432 0 3 if ($code != 2)
441 3 0 if ($$self{'cddb_protocol'} != 1)
444 0 3 if ($code != 2)
479 0 1 unless $code
481 1 0 if ($code == 2)
483 1 0 if defined $genres
517 2 2 if (defined $seconds_previous) { }
529 2 2 if ($track == 999)
535 0 2 if ($track == 1000)
558 2 0 if wantarray
570 0 0 unless open FH, $command
574 0 0 if (/(\d+):\s+(\d+):(\d+):(\d+)/)
576 0 0 if /leadout/
596 5 0 if (ref $offsets eq 'ARRAY') { }
615 0 5 unless $self->command('cddb query', $id, $track_count, $offsets_string, $total_seconds)
623 0 5 if $self->code == 417
628 0 5 unless defined $code and $code == 2
631 1 4 if ($self->code == 200)
639 0 4 if $self->code == 202
644 4 0 if ($self->code == 210 or $self->code == 211)
646 0 4 unless defined $discs
672 1 0 if (@info = $self->calculate_id(@_))
701 0 1 if (exists $$self{'got tracks before'})
703 0 0 unless $self->connect
709 0 1 if ($code != 2)
718 0 1 unless (defined($track_file = $self->read_until_dot))
741 3 16 if ($state eq 'beginning')
742 1 2 if ($line =~ /track\s*frame\s*off/i)
748 2 14 if ($state eq 'offsets')
749 1 1 if ($line =~ /^\#\s*(\d+)/)
758 8 7 if ($state eq 'headers')
759 7 1 if ($line =~ /^\#/)
761 4 3 if (my($header, $value) = $line =~ /^\#\s*(.*?)\:\s*(.*?)\s*$/)
771 8 0 if ($state eq 'data')
773 2 6 unless my($tag, $idx, $val) = $line =~ /^\s*(.+?)(\d*)\s*\=\s*(.+?)\s*$/
777 1 5 if ($idx ne '') { }
779 1 0 unless exists $details{$tag}
841 0 1 if defined $$self{'mail_from'}
852 0 1 if defined $$self{'mail_host'}
854 0 1 if (exists $ENV{'SMTPHOSTS'}) { }
1 0 elsif (defined inet_aton('mail')) { }
872 0 1 unless $imported_mail
877 0 1 unless (defined $$self{'hostname'})
878 0 0 unless $$self{'hostname'} = &hostname()
882 0 1 unless exists $params{'Genre'}
883 0 1 unless exists $params{'Id'}
884 0 1 unless exists $params{'Artist'}
885 0 1 unless exists $params{'DiscTitle'}
886 0 1 unless exists $params{'TrackTitles'}
887 0 1 unless exists $params{'Offsets'}
888 0 1 unless exists $params{'Revision'}
889 0 1 if (exists $params{'Year'})
890 0 0 unless ($params{'Year'} =~ /^\d{4}$/)
894 0 1 if (exists $params{'GenreLong'})
895 0 0 unless ($params{'GenreLong'} =~ /^([A-Z][a-zA-Z0-9]*\s?)+$/)
908 0 1 if exists $params{'Host'}
913 0 1 if exists $params{'From'}
919 1 0 $$self{'utf8'} ? :
926 0 1 if $$self{'debug'}
946 0 1 if (exists $params{'Year'})
949 0 1 if (exists $params{'GenreLong'})
995 0 0 unless $mail->send('sendmail')
997 0 1 unless $@
1001 0 0 unless $mail->send('smtp', 'Server', $host)
1003 0 1 unless $@