Branch Coverage

blib/lib/Net/Server/Proto.pm
Criterion Covered Total %
branch 122 194 62.8


line true false branch
47 270 1083 unless (grep {$_ eq $func;} @EXPORT_OK)
48 0 270 if $func =~ /^_/
49 0 270 unless (exists &$func)
52 0 0 unless grep {$_ eq $func;} @Socket::EXPORT, @Socket::EXPORT_OK or $have6 || !defined($have6) && eval { do { ($have6 = 0) = require Socket6 } } and grep {$_ eq $func;} @Socket6::EXPORT, @Socket6::EXPORT_OK
56 0 270 if grep {$_ eq $func;} @EXPORT_DENIED
103 0 0 $sub->{$fullname} ? :
0 780 if exists $sub->{$fullname}
108 0 780 if $have6 or not defined $have6 and eval { do { ($have6 ||= 0) ||= do { require Socket6; 1 } } }
109 780 0 if (my $code = $sub->{$fullname})
111 0 780 unless eval { do { *{"${_}::$basename";} = $code foreach (keys %{$$exported{$basename};}); *$fullname = $code } }
113 297 483 $c[5] ? :
0 780 unless (eval { do { @res = $c[5] ? &$code(@_) : scalar &$code(@_); 1 } })
114 297 483 $c[5] ? :
118 1672 228 unless exists &$func
129 0 211 unless (eval { do { @res = getnameinfo($sockaddr, $flags, $xflags); 1 } })
131 0 0 if (@res < 2) { }
133 0 0 if $xflags & 1
134 0 0 if $xflags & 2
149 0 106 if "HASH" ne ref $hints or @_ < 2 or @_ > 3
150 0 106 if @res < 2
151 0 106 unless eval { do { @res = getaddrinfo($host, $port, $hints); die $res[0] || 'EAI_NONAME' if @res < 2; 1 } } or eval { do { @res = ""; my(@results) = getaddrinfo($host, $port, map({0 unless $hints->{$_};} "family", "socktype", "protocol", "flags")); while (@results > 4) { my $r = {}; (@$r{"family", "socktype", "protocol", "addr", "canonname"}, @results) = @results; push @res, $r; } ; $res[0] ||= "EAI_NONAME" if @res < 2; 1 } }
153 0 0 unless $hints->{$_}
159 0 0 if @res < 2
168 83 9 if defined $can_disable_v6only
169 0 9 unless socket my $testsock, &AF_INET6(), &SOCK_STREAM(), 0
170 9 0 if setsockopt $testsock, IPPROTO_IPV6(), &IPV6_V6ONLY(), 0
171 0 0 if $!{'EINVAL'} or $!{'EOPNOTSUPP'}
176 0 130 $_[0] eq __PACKAGE__ ? :
180 12 118 if (ref $port eq 'HASH') { }
181 0 12 unless $port->{'port'}
185 1 117 if $port =~ s( (?<=[\w*\]]) [,|\s:/]+ (sock_stream|sock_dgram) \b )[]x
187 15 103 if $port =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
188 2 116 if $port =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
189 34 84 if $port =~ s( (?<=[\w*\]]) [,|\s:/]+ (tcp|udp|ssl|ssleay|unix|unixdgram|\w+(?: ::\w+)+) $ )[]xi or $port =~ s[ / (\w+) $ ][]x
191 27 91 if $port =~ s/ ^ (.*?) [,|\s:]+ (?= \w+ $) //x
197 64 63 defined $host && length $host ? :
198 1 129 if $info->{'host'} =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
199 0 130 if $info->{'host'} =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
200 4 126 if ($info->{'host'} =~ m(^ \[ ([\w/.\-:]+ | \*?) \] $ )x) { }
126 0 elsif ($info->{'host'} =~ m[^ ([\w/.\-:]+ | \*?) $ ]x) { }
201 4 0 length $1 ? :
210 1 129 if $info->{'proto'} =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
211 0 130 if $info->{'proto'} =~ s( (?<=[\w*\]]) [,|\s:/]+ IPv([*\d]+) )[]xi
212 130 0 if ($info->{'proto'} =~ /^(\w+ (?:::\w+)*)$/x) { }
219 8 122 if ($info->{'proto'} =~ /^UNIX/i)
223 1 121 if ref $ipv eq "ARRAY"
224 0 122 if $ipv and not $ipv =~ /[46*]/
226 46 76 if (!$ipv || $ipv =~ /[*]/ and eval { do { CAN_DISABLE_V6ONLY() } }) { }
19 57 elsif ($ipv =~ /6/ or $info->{'host'} =~ /:/) { }
228 0 46 unless @rows
231 44 2 $warn ? :
233 0 46 if (@rows > 1 and $rows[0][1] == 0)
241 44 2 if $_info->{'host'} ne $info->{'host'} or $_info->{'port'} ne $info->{'port'}
242 44 2 if $_info->{'warn'}
246 6 13 if $ipv =~ /4/ and not $info->{'host'} =~ /:/
255 107 0 $_[0] eq __PACKAGE__ ? :
257 0 107 unless defined $host
258 61 46 unless defined $port
259 61 46 unless defined $proto
260 61 46 unless defined $server
261 0 107 if $proto =~ /UNIX/i
262 0 107 if $port =~ /\D/
265 1 106 if ($host =~ /^\d+(?:\.\d+){3}$/) { }
106 0 elsif (eval { do { &AI_PASSIVE() } }) { }
0 0 elsif ($host =~ /:/) { }
266 0 1 unless my $addr = inet_aton($host)
269 0 106 lc $proto eq 'udp' ? :
270 0 106 lc $proto eq 'udp' ? :
271 44 62 $host eq '*' ? :
272 0 106 if $err or @res < 1 and $err = "getaddrname: ${host}: FAILURE!"
275 0 211 if $err or not $ip
276 106 0 $r->{'family'} == &AF_INET6() ? :
105 106 $r->{'family'} == &AF_INET() ? :
279 0 167 $_->[0] =~ /^::ffff:(\d+(?:\.\d+){3})$/i ? :
44 167 if ($_->[0] eq '::') { }
280 44 62 if (keys %ipv6mapped and grep {$ipv6mapped{$_->[0]};} @info)
282 44 44 unless my $i6 = $ipv6mapped{$i4->[0]}
283 1 43 if (not eval { do { ipv6_package($server)->new('LocalAddr', $i6->[0], 'Type', $socktype) } }) { }
43 0 elsif ($i6->[2] eq '6' and eval { do { CAN_DISABLE_V6ONLY() } }) { }
298 0 0 if ($host eq '*') { }
302 0 0 unless @addr
311 0 136 $_[0] eq __PACKAGE__ ? :
314 135 1 unless ($proto_class =~ /::/)
315 0 135 unless $proto_class =~ /^\w+$/
319 0 136 unless eval { do { require $file; 1 } }
320 4 132 if $server->{'server'}{'ipv6_package'}
325 53 28 if $ipv6_package
326 3 25 if $ENV{'NO_IPV6'}
327 12 13 @_ && $_[0] eq __PACKAGE__ ? :
329 0 25 unless eval { do { require Net::Server::IP; 1 } } or not warn("ipv6_package: Failure! [$!] [$@]")
330 4 21 if (not $Net::Server::IP::ipv6_package and my $pkg = $server->{'server'} && $server->{'server'}{'ipv6_package'})
338 0 1 if $IPV6_V6ONLY
341 0 0 $^O =~ /^(?:darwin|freebsd|openbsd|netbsd|dragonfly|MSWin32|solaris|svr4)$/ ? :
0 0 $^O eq 'linux' ? :
343 0 1 unless ($IPV6_V6ONLY)
344 0 0 if not eval { do { $IPV6_V6ONLY = do "$d.pl" } } and $IPV6_V6ONLY = do { mkdir $d; `h2ph -d $d -a netinet/in.h 2>/dev/null`; eval `echo "package _h2ph_shush_ipv6only;";grep -rl "sub IPV6_V6ONLY" $d|xargs cat|grep "sub IPV6_V6ONLY";echo "IPV6_V6ONLY()"` }
346 1 0 if ($IPV6_V6ONLY)