Branch Coverage

blib/lib/IO/Socket/IP.pm
Criterion Covered Total %
branch 134 214 62.6


line true false branch
128 1 0 if ($_ eq '-register') { }
130 1 0 if defined $AF_INET6
146 0 0 if defined $can_disable_v6only
148 0 0 unless CORE::socket my $testsock, 10, 1, 0
151 0 0 if (setsockopt $testsock, 41, 26, 0) { }
0 0 elsif ($! == 22 or $! == 95) { }
152 0 0 if ($^O eq "dragonfly")
154 0 0 if (getsockopt $testsock, 41, 26)
375 10 51 @_ == 1 ? :
387 0 55 if exists $arg->{'PeerAddr'} and not exists $arg->{'PeerHost'}
390 5 50 if exists $arg->{'PeerPort'} and not exists $arg->{'PeerService'}
393 0 55 if exists $arg->{'LocalAddr'} and not exists $arg->{'LocalHost'}
396 13 42 if exists $arg->{'LocalPort'} and not exists $arg->{'LocalService'}
402 47 63 if (defined $arg->{$host})
405 10 37 if defined $s
423 0 11 if (defined $listenqueue and defined $arg->{'PeerHost'} || defined $arg->{'PeerService'} || defined $arg->{'PeerAddrInfo'})
428 6 33 if (defined $arg->{'GetAddrInfoFlags'}) { }
435 3 36 if (defined(my $family = $arg->{'Family'}))
439 23 16 if (defined(my $type = $arg->{'Type'}))
443 0 39 if (defined(my $proto = $arg->{'Proto'}))
444 0 0 unless ($proto =~ /^\d+$/u)
448 0 0 unless defined $protonum
457 16 0 unless (defined $hints{'socktype'} or defined $hints{'protocol'})
464 0 39 if (not defined $hints{'socktype'} and defined $hints{'protocol'})
465 0 0 if $hints{'protocol'} == 6
466 0 0 if $hints{'protocol'} == 17
469 1 38 if (my $info = $arg->{'LocalAddrInfo'}) { }
23 15 elsif (defined $arg->{'LocalHost'} or defined $arg->{'LocalService'} or 0) { }
470 0 1 unless ref $info eq "ARRAY"
480 0 23 unless (defined $host or defined $service)
485 1 22 if defined $service and $service =~ s/\((\d+)\)$//u
492 1 22 if ($err and defined $fallback_port)
496 5 18 if ($err)
503 1 33 if (my $info = $arg->{'PeerAddrInfo'}) { }
12 21 elsif (defined $arg->{'PeerHost'} or defined $arg->{'PeerService'}) { }
504 0 1 unless ref $info eq "ARRAY"
508 0 12 unless defined(my $host = $arg->{'PeerHost'})
510 0 12 unless defined(my $service = $arg->{'PeerService'})
514 0 12 if defined $service and $service =~ s/\((\d+)\)$//u
519 0 12 if ($err and defined $fallback_port)
523 0 12 if ($err)
533 1 33 if $arg->{'ReuseAddr'}
534 1 33 if $arg->{'ReusePort'}
535 1 33 if $arg->{'Broadcast'}
537 1 33 if (my $sockopts = $arg->{'Sockopts'})
538 0 1 unless ref $sockopts eq "ARRAY"
540 0 1 unless ref $_ eq "ARRAY"
541 0 1 unless @$_ >= 2 and @$_ <= 3
547 1 0 unless defined $value
553 31 3 unless defined $blocking
560 0 34 if (defined $arg->{'MultiHomed'} and not $arg->{'MultiHomed'})
565 19 15 @localinfos ? :
566 13 21 @peerinfos ? :
568 0 19 if defined $local->{'family'} and defined $peer->{'family'} and $local->{'family'} != $peer->{'family'}
570 0 19 if defined $local->{'socktype'} and defined $peer->{'socktype'} and $local->{'socktype'} != $peer->{'socktype'}
572 0 19 if defined $local->{'protocol'} and defined $peer->{'protocol'} and $local->{'protocol'} != $peer->{'protocol'}
574 2 32 unless my $family = $local->{'family'} || $peer->{'family'}
575 0 32 unless my $socktype = $local->{'socktype'} || $peer->{'socktype'}
588 2 32 unless (@infos)
590 1 1 if (defined $hints{'family'}) { }
601 0 1 if ($err)
629 0 34 unless $self->setup or not $blocking
640 1 34 if do { *$self }->{'io_socket_ip_idx'} >= @{do { *$self }->{'io_socket_ip_infos'};}
645 0 34 unless $self->socket(@{$info;}{"family", "socktype", "protocol"})
647 3 31 unless do { *$self }->{'io_socket_ip_blocking'}
651 0 4 unless $self->setsockopt($level, $optname, $value)
655 0 0 if (defined do { *$self }->{'io_socket_ip_v6only'} and defined $AF_INET6 and $info->{'family'} == $AF_INET6)
657 0 0 unless $self->setsockopt(41, 26, pack("i", $v6only))
661 19 15 if (defined(my $addr = $info->{'localaddr'}))
663 0 19 unless $self->bind($addr)
666 11 23 if (defined(my $listenqueue = do { *$self }->{'io_socket_ip_listenqueue'}))
667 0 11 unless $self->listen($listenqueue)
671 13 21 if (defined(my $addr = $info->{'peeraddr'}))
672 10 3 if ($self->connect($addr))
677 3 0 if ($! == 115 or $! == 11)
687 0 0 unless $!
712 16 4 if (@_)
719 15 1 unless defined $timeout
723 0 1 defined CORE::connect($self, $addr) ? :
725 0 1 if (not $err) { }
0 1 elsif (not $err == 115 || $err == 11) { }
0 1 elsif (not $was_blocking) { }
741 0 1 unless (select undef, $vec, $vec, $timeout)
749 0 1 if $err == 106
753 0 1 if $err
757 0 4 unless do { *$self }->{'io_socket_ip_connect_in_progress'}
760 1 3 if (my $errno = $self->getsockopt(1, 4))
772 2 1 if (CORE::connect $self, $addr or $! == 106) { }
803 8 57 unless defined $addr
806 23 34 if $self->socktype == 2
809 0 57 if $err
819 8 6 if ($family == 2) { }
6 0 elsif (defined $AF_INET6 and $family == $AF_INET6) { }
852 0 0 $numeric ? :
917 0 0 $numeric ? :
968 0 6 unless my($new, $peer) = $self->SUPER::accept(@_)
972 0 6 wantarray ? :
981 35 2 unless defined $self->fileno
984 0 2 unless CORE::socket my $tmph, $_[0], $_[1], $_[2]
986 0 2 unless dup2($tmph->fileno, $self->fileno)
992 0 22 if (eval $IO::Socket::VERSION < "1.35")
996 0 0 unless (defined $type)
1024 0 1 unless $self->sockdomain == 2
1161 17 34 if ($addr =~ /\A\[($IPv6_re)\](?::([^\s:]*))?\z/u or $addr =~ /\A([^\s:]*):([^\s:]*)\z/u)
1163 13 4 if defined $2 and length $2
1191 1 3 if $host =~ /:/u
1193 3 1 if defined $port