Branch Coverage

blib/lib/AnyEvent/Socket.pm
Criterion Covered Total %
branch 92 214 42.9


line true false branch
73 2 21 unless $_[0] =~ /^ (?: 0x[0-9a-fA-F]+ | 0[0-7]* | [1-9][0-9]* ) (?:\. (?: 0x[0-9a-fA-F]+ | 0[0-7]* | [1-9][0-9]* ) ){0,3}$/x
77 31 50 /^0/ ? :
80 0 21 if grep(($_ >= 256), @_[0 .. @_ - 2])
83 0 21 if $_[-1] >= 2 ** (8 * (4 - $#_))
116 18 13 if ($n < 2 or $n > 8)
117 16 2 if (not $n and my $ipn = &parse_ipv4($_[0]))
125 0 13 unless (defined $t)
133 4 9 if (@t and $t[-1] =~ /\./)
134 0 4 if $n > 6
136 0 4 unless my $ipn = &parse_ipv4(pop @t)
143 0 13 unless @h + @t == 8 or $_[0] =~ /::/
146 0 13 if grep((!/^[0-9a-fA-F]{1,4}$/), @h, @t)
167 0 2 $_[0] eq 'unix/' ? :
203 17 2 if ($_) { }
238 0 8 unless defined(my $proton = $PROTO_BYNAME{$name} || (CORE::getprotobyname $name)[2])
296 0 18 if m[^/]
300 13 5 unless (($host) = /^\s* ([0-9a-fA-F:]*:[0-9a-fA-F:]*:[0-9a-fA-F\.:]*)/cgx and &parse_ipv6($host))
306 6 7 if (/^ \[ ([^\[\]]+) \]/cgx) { }
6 1 elsif (/^ ([^\[\]:\ ]+) /cgx) { }
316 8 9 if (/\G (?:\s+|:|\#) ([^:[:space:]]+) \s*$/cgx) { }
6 3 elsif (/\G\s*$/cg and length $_[1]) { }
327 0 14 if $host =~ /:/ and not &parse_ipv6($host)
342 0 0 if length $port
343 0 0 if $host =~ /:/
356 2 0 16 == length $_[0] ? :
31 2 4 == length $_[0] ? :
407 0 0 if ($_[0] =~ /^\x00\x00\x00\x00\x00\x00\x00\x00/)
408 0 0 if (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.0 eq $_[0]) { }
0 0 elsif (v0.0.0.0.0.0.0.0.0.0.0.0.0.0.0.1 eq $_[0]) { }
0 0 elsif (v0.0.0.0.0.0.0.0.0.0.0.0 eq substr($_[0], 0, 12)) { }
0 0 elsif (v0.0.0.0.0.0.0.0.0.0.255.255 eq substr($_[0], 0, 12)) { }
0 0 elsif (v0.0.0.0.0.0.0.0.255.255.0.0 eq substr($_[0], 0, 12)) { }
427 0 0 unless $ip =~ s/(?:^|:) 0:0:0:0:0:0:0 (?:$|:)/::/x or $ip =~ s/(?:^|:) 0:0:0:0:0:0 (?:$|:)/::/x or $ip =~ s/(?:^|:) 0:0:0:0:0 (?:$|:)/::/x or $ip =~ s/(?:^|:) 0:0:0:0 (?:$|:)/::/x or $ip =~ s/(?:^|:) 0:0:0 (?:$|:)/::/x
438 20 0 if (4 == length $_[0]) { }
0 0 elsif (16 == length $_[0]) { }
0 0 elsif (1 == &address_family($_[0])) { }
441 0 0 $_[0] =~ /^\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\xff\xff(....)$/s ? :
483 0 0 if (my $ipn = &parse_ipv4) { }
0 0 elsif (my $ipn = &parse_ipv6) { }
0 0 elsif ($name eq 'localhost') { }
490 0 0 unless $AnyEvent::DNS::VERSION
503 0 0 if ($ipv4)
511 0 0 if ($ipv6)
530 0 0 Socket::pack_sockaddr_in(21845, 'UUUU' | eval { do { Socket::pack_sockaddr_un('U') } }) =~ /^\x00/ ? :
8 0 $Socket::VERSION >= 1.75 ? :
558 19 1 if ($af == 2) { }
1 0 elsif ($af == 10) { }
0 0 elsif ($af == 1) { }
603 25 0 if ($af == 2) { }
0 0 elsif ($af == 10) { }
0 0 elsif ($af == 1) { }
678 0 1 unless @aliases
680 1 0 if (my $ip = &parse_ipv4($addr)) { }
0 0 elsif (my $ip = &parse_ipv6($addr)) { }
696 0 4 if (@dns) { }
700 4 0 length $ENV{'PERL_ANYEVENT_HOSTS'} ? :
708 4 0 unless ($#HOSTS_CHECKING)
713 1 3 if ((stat _)[9] ne $HOSTS_MTIME) { }
733 0 8 if ($node eq 'unix/')
734 0 0 if $family or not $service =~ m[^/]
736 0 0 defined $type ? :
746 0 8 if $family == 4 and not $AnyEvent::PROTOCOL{'ipv4'}
747 0 8 if $family == 6 and not $AnyEvent::PROTOCOL{'ipv6'}
749 0 8 unless $AnyEvent::PROTOCOL{'ipv6'}
750 0 8 unless $AnyEvent::PROTOCOL{'ipv4'}
753 0 8 $proto eq 'udp' ? :
755 0 8 unless my $proton = &AnyEvent::Socket::getprotobyname($proto)
760 0 8 if ($service =~ /^(\S+)=(\d+)$/) { }
8 0 elsif ($service =~ /^\d+$/) { }
765 0 0 unless $port = (getservbyname $service, $proto)[2]
778 0 1 unless $AnyEvent::PROTOCOL{$AnyEvent::Socket::b->[1]} <=> $AnyEvent::PROTOCOL{$AnyEvent::Socket::a->[1]}
789 7 2 if (my $noden = &parse_address($node)) { }
792 6 1 if ($af == 2 and $family != 6)
797 1 6 if ($af == 10 and $family != 4)
805 2 0 if ($family != 6)
821 2 0 if ($family != 4)
839 0 8 if $node =~ /[^\x00-\x7f]/
843 1 7 if ($node eq 'localhost') { }
0 7 elsif (defined $service and not &parse_address($node)) { }
849 0 0 if (@srv) { }
851 0 0 unless $srv[0][2] ne '' or $#srv
1003 0 6 unless exists $state{'fh'}
1008 0 0 unless exists $state{'fh'}
1012 0 6 unless my $target = shift @target
1018 0 6 unless socket $state{'fh'}, $domain, $type, $proto
1029 0 6 if $timeout
1032 6 0 if (connect $state{'fh'}, $sockaddr or ($! == 115 or $! == 11 or $! == -1e+99 or $! == -1e+99)) { }
1042 6 0 if (my $sin = getpeername $state{'fh'}) { }
1054 0 0 if ($! == 107)
1067 0 0 if $! == 11
1084 6 0 if defined wantarray
1180 0 1 $AnyEvent::PROTOCOL{'ipv4'} < $AnyEvent::PROTOCOL{'ipv6'} && 10 ? :
1 5 unless defined $host
1184 0 6 unless my $ipn = &parse_address($host)
1195 0 6 unless socket my $fh, $af, 1, 0
1200 6 0 if ($af == 2 or $af == 10) { }
0 0 elsif ($af == 1) { }
1201 0 6 unless setsockopt $fh, 1, 2, 1
1205 0 6 unless ($service =~ /^\d*$/)
1206 0 0 unless $service = (getservbyname $service, 'tcp')[2]
1213 0 6 unless bind $fh, &pack_sockaddr($service, $ipn)
1216 0 6 if ($af == 1 and defined wantarray)
1220 0 0 if (lstat $service)[1] == $ino
1229 6 0 if ($prepare)
1236 0 6 unless listen $fh, $len
1244 1 5 defined wantarray ? :
1296 0 0 defined 13 ? :