Branch Coverage

blib/lib/IO/Socket/IP.pm
Criterion Covered Total %
branch 132 214 61.6


line true false branch
126 1 0 if ($_ eq '-register') { }
128 1 0 if defined $AF_INET6
144 0 0 if defined $can_disable_v6only
146 0 0 unless CORE::socket my $testsock, 10, 1, 0
149 0 0 if (setsockopt $testsock, 41, 26, 0) { }
0 0 elsif ($! == 22 or $! == 95) { }
150 0 0 if ($^O eq "dragonfly")
152 0 0 if (getsockopt $testsock, 41, 26)
373 10 46 @_ == 1 ? :
385 0 51 if exists $arg->{'PeerAddr'} and not exists $arg->{'PeerHost'}
388 5 46 if exists $arg->{'PeerPort'} and not exists $arg->{'PeerService'}
391 0 51 if exists $arg->{'LocalAddr'} and not exists $arg->{'LocalHost'}
394 11 40 if exists $arg->{'LocalPort'} and not exists $arg->{'LocalService'}
400 43 59 if (defined $arg->{$host})
403 10 33 if defined $s
421 0 10 if (defined $listenqueue and defined $arg->{'PeerHost'} || defined $arg->{'PeerService'} || defined $arg->{'PeerAddrInfo'})
426 2 33 if (defined $arg->{'GetAddrInfoFlags'}) { }
433 3 32 if (defined(my $family = $arg->{'Family'}))
437 19 16 if (defined(my $type = $arg->{'Type'}))
441 0 35 if (defined(my $proto = $arg->{'Proto'}))
442 0 0 unless ($proto =~ /^\d+$/u)
446 0 0 unless defined $protonum
455 16 0 unless (defined $hints{'socktype'} or defined $hints{'protocol'})
462 0 35 if (not defined $hints{'socktype'} and defined $hints{'protocol'})
463 0 0 if $hints{'protocol'} == 6
464 0 0 if $hints{'protocol'} == 17
467 1 34 if (my $info = $arg->{'LocalAddrInfo'}) { }
21 13 elsif (defined $arg->{'LocalHost'} or defined $arg->{'LocalService'} or 0) { }
468 0 1 unless ref $info eq "ARRAY"
478 0 21 unless (defined $host or defined $service)
483 1 20 if defined $service and $service =~ s/\((\d+)\)$//u
490 1 20 if ($err and defined $fallback_port)
494 5 16 if ($err)
501 1 29 if (my $info = $arg->{'PeerAddrInfo'}) { }
10 19 elsif (defined $arg->{'PeerHost'} or defined $arg->{'PeerService'}) { }
502 0 1 unless ref $info eq "ARRAY"
506 0 10 unless defined(my $host = $arg->{'PeerHost'})
508 0 10 unless defined(my $service = $arg->{'PeerService'})
512 0 10 if defined $service and $service =~ s/\((\d+)\)$//u
517 0 10 if ($err and defined $fallback_port)
521 0 10 if ($err)
531 1 29 if $arg->{'ReuseAddr'}
532 1 29 if $arg->{'ReusePort'}
533 1 29 if $arg->{'Broadcast'}
535 1 29 if (my $sockopts = $arg->{'Sockopts'})
536 0 1 unless ref $sockopts eq "ARRAY"
538 0 1 unless ref $_ eq "ARRAY"
539 0 1 unless @$_ >= 2 and @$_ <= 3
545 1 0 unless defined $value
551 27 3 unless defined $blocking
558 0 30 if (defined $arg->{'MultiHomed'} and not $arg->{'MultiHomed'})
563 17 13 @localinfos ? :
564 11 19 @peerinfos ? :
566 0 17 if defined $local->{'family'} and defined $peer->{'family'} and $local->{'family'} != $peer->{'family'}
568 0 17 if defined $local->{'socktype'} and defined $peer->{'socktype'} and $local->{'socktype'} != $peer->{'socktype'}
570 0 17 if defined $local->{'protocol'} and defined $peer->{'protocol'} and $local->{'protocol'} != $peer->{'protocol'}
572 2 28 unless my $family = $local->{'family'} || $peer->{'family'}
573 0 28 unless my $socktype = $local->{'socktype'} || $peer->{'socktype'}
586 2 28 unless (@infos)
588 1 1 if (defined $hints{'family'}) { }
599 0 1 if ($err)
627 0 30 unless $self->setup or not $blocking
638 1 30 if do { *$self }->{'io_socket_ip_idx'} >= @{do { *$self }->{'io_socket_ip_infos'};}
643 0 30 unless $self->socket(@{$info;}{"family", "socktype", "protocol"})
645 3 27 unless do { *$self }->{'io_socket_ip_blocking'}
649 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))
659 17 13 if (defined(my $addr = $info->{'localaddr'}))
661 0 17 unless $self->bind($addr)
664 10 20 if (defined(my $listenqueue = do { *$self }->{'io_socket_ip_listenqueue'}))
665 0 10 unless $self->listen($listenqueue)
669 11 19 if (defined(my $addr = $info->{'peeraddr'}))
670 8 3 if ($self->connect($addr))
675 3 0 if ($! == 115 or $! == 11)
685 0 0 unless $!
710 13 5 if (@_)
717 12 1 unless defined $timeout
721 0 1 defined CORE::connect($self, $addr) ? :
723 0 1 if (not $err) { }
0 1 elsif (not $err == 115 || $err == 11) { }
0 1 elsif (not $was_blocking) { }
739 0 1 unless (select undef, $vec, $vec, $timeout)
747 0 1 if $err == 106
751 0 1 if $err
755 0 5 unless do { *$self }->{'io_socket_ip_connect_in_progress'}
758 1 4 if (my $errno = $self->getsockopt(1, 4))
770 2 2 if (CORE::connect $self, $addr or $! == 106) { }
801 6 43 unless defined $addr
804 16 27 if $self->socktype == 2
807 0 43 if $err
817 8 0 if ($family == 2) { }
0 0 elsif (defined $AF_INET6 and $family == $AF_INET6) { }
850 0 0 $numeric ? :
915 0 0 $numeric ? :
966 0 5 unless my($new, $peer) = $self->SUPER::accept(@_)
970 0 5 wantarray ? :
979 31 2 unless defined $self->fileno
982 0 2 unless CORE::socket my $tmph, $_[0], $_[1], $_[2]
984 0 2 unless dup2($tmph->fileno, $self->fileno)
990 0 22 if (eval $IO::Socket::VERSION < "1.35")
994 0 0 unless (defined $type)
1022 0 1 unless $self->sockdomain == 2
1155 17 30 if ($addr =~ /\A\[($IPv6_re)\](?::([^\s:]*))?\z/u or $addr =~ /\A([^\s:]*):([^\s:]*)\z/u)
1157 13 4 if defined $2 and length $2
1185 1 3 if $host =~ /:/u
1187 3 1 if defined $port