Branch Coverage

blib/lib/IO/Socket/IP.pm
Criterion Covered Total %
branch 132 210 62.8


line true false branch
133 1 0 if ($_ eq '-register') { }
135 1 0 if defined $AF_INET6
151 0 0 if defined $can_disable_v6only
153 0 0 unless CORE::socket my $testsock, 10, 1, 0
156 0 0 if (setsockopt $testsock, 41, 26, 0) { }
0 0 elsif ($! == 22 or $! == 95) { }
374 10 46 @_ == 1 ? :
386 0 51 if exists $arg->{'PeerAddr'} and not exists $arg->{'PeerHost'}
389 5 46 if exists $arg->{'PeerPort'} and not exists $arg->{'PeerService'}
392 0 51 if exists $arg->{'LocalAddr'} and not exists $arg->{'LocalHost'}
395 11 40 if exists $arg->{'LocalPort'} and not exists $arg->{'LocalService'}
401 43 59 if (defined $arg->{$host})
404 10 33 if defined $s
422 0 10 if (defined $listenqueue and defined $arg->{'PeerHost'} || defined $arg->{'PeerService'} || defined $arg->{'PeerAddrInfo'})
427 2 33 if (defined $arg->{'GetAddrInfoFlags'}) { }
434 3 32 if (defined(my $family = $arg->{'Family'}))
438 19 16 if (defined(my $type = $arg->{'Type'}))
442 0 35 if (defined(my $proto = $arg->{'Proto'}))
443 0 0 unless ($proto =~ /^\d+$/)
447 0 0 unless defined $protonum
456 16 0 unless (defined $hints{'socktype'} or defined $hints{'protocol'})
463 0 35 if (not defined $hints{'socktype'} and defined $hints{'protocol'})
464 0 0 if $hints{'protocol'} == 6
465 0 0 if $hints{'protocol'} == 17
468 1 34 if (my $info = $arg->{'LocalAddrInfo'}) { }
21 13 elsif (defined $arg->{'LocalHost'} or defined $arg->{'LocalService'} or 0) { }
469 0 1 unless ref $info eq 'ARRAY'
479 0 21 unless (defined $host or defined $service)
484 1 20 if defined $service and $service =~ s/\((\d+)\)$//
491 1 20 if ($err and defined $fallback_port)
495 5 16 if ($err)
502 1 29 if (my $info = $arg->{'PeerAddrInfo'}) { }
10 19 elsif (defined $arg->{'PeerHost'} or defined $arg->{'PeerService'}) { }
503 0 1 unless ref $info eq 'ARRAY'
507 0 10 unless defined(my $host = $arg->{'PeerHost'})
509 0 10 unless defined(my $service = $arg->{'PeerService'})
513 0 10 if defined $service and $service =~ s/\((\d+)\)$//
518 0 10 if ($err and defined $fallback_port)
522 0 10 if ($err)
532 1 29 if $arg->{'ReuseAddr'}
533 1 29 if $arg->{'ReusePort'}
534 1 29 if $arg->{'Broadcast'}
536 1 29 if (my $sockopts = $arg->{'Sockopts'})
537 0 1 unless ref $sockopts eq 'ARRAY'
539 0 1 unless ref $_ eq 'ARRAY'
540 0 1 unless @$_ >= 2 and @$_ <= 3
546 1 0 unless defined $value
552 27 3 unless defined $blocking
559 0 30 if (defined $arg->{'MultiHomed'} and not $arg->{'MultiHomed'})
564 17 13 @localinfos ? :
565 11 19 @peerinfos ? :
567 0 17 if defined $local->{'family'} and defined $peer->{'family'} and $local->{'family'} != $peer->{'family'}
569 0 17 if defined $local->{'socktype'} and defined $peer->{'socktype'} and $local->{'socktype'} != $peer->{'socktype'}
571 0 17 if defined $local->{'protocol'} and defined $peer->{'protocol'} and $local->{'protocol'} != $peer->{'protocol'}
573 2 28 unless my $family = $local->{'family'} || $peer->{'family'}
574 0 28 unless my $socktype = $local->{'socktype'} || $peer->{'socktype'}
587 2 28 unless (@infos)
589 1 1 if (defined $hints{'family'}) { }
600 0 1 if ($err)
628 0 30 unless $self->setup or not $blocking
639 1 30 if do { *$self }->{'io_socket_ip_idx'} >= @{do { *$self }->{'io_socket_ip_infos'};}
644 0 30 unless $self->socket(@{$info;}{'family', 'socktype', 'protocol'})
646 3 27 unless do { *$self }->{'io_socket_ip_blocking'}
650 0 4 unless $self->setsockopt($level, $optname, $value)
653 0 0 if (defined do { *$self }->{'io_socket_ip_v6only'} and defined $AF_INET6 and $info->{'family'} == $AF_INET6)
655 0 0 unless $self->setsockopt(41, 26, pack('i', $v6only))
658 17 13 if (defined(my $addr = $info->{'localaddr'}))
660 0 17 unless $self->bind($addr)
663 10 20 if (defined(my $listenqueue = do { *$self }->{'io_socket_ip_listenqueue'}))
664 0 10 unless $self->listen($listenqueue)
667 11 19 if (defined(my $addr = $info->{'peeraddr'}))
668 8 3 if ($self->connect($addr))
673 3 0 if ($! == 115 or $! == 11)
683 0 0 unless $!
708 13 5 if (@_)
715 12 1 unless defined $timeout
719 0 1 defined CORE::connect($self, $addr) ? :
721 0 1 if (not $err) { }
0 1 elsif (not $err == 115 || $err == 11) { }
0 1 elsif (not $was_blocking) { }
737 0 1 unless (select undef, $vec, $vec, $timeout)
745 0 1 if $err == 106
749 0 1 if $err
753 0 5 unless do { *$self }->{'io_socket_ip_connect_in_progress'}
756 1 4 if (my $errno = $self->getsockopt(1, 4))
768 2 2 if (CORE::connect $self, $addr or $! == 106) { }
799 6 43 unless defined $addr
802 16 27 if $self->socktype == 2
805 0 43 if $err
815 8 0 if ($family == 2) { }
0 0 elsif (defined $AF_INET6 and $family == $AF_INET6) { }
848 0 0 $numeric ? :
913 0 0 $numeric ? :
964 0 5 unless my($new, $peer) = $self->SUPER::accept(@_)
968 0 5 wantarray ? :
977 31 2 unless defined $self->fileno
980 0 2 unless CORE::socket my $tmph, $_[0], $_[1], $_[2]
982 0 2 unless dup2($tmph->fileno, $self->fileno)
988 0 22 if (eval $IO::Socket::VERSION < 1.35)
992 0 0 unless (defined $type)
1020 0 1 unless $self->sockdomain == 2
1153 17 30 if ($addr =~ /\A\[($IPv6_re)\](?::([^\s:]*))?\z/ or $addr =~ /\A([^\s:]*):([^\s:]*)\z/)
1155 13 4 if defined $2 and length $2
1183 1 3 if $host =~ /:/
1185 3 1 if defined $port