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) { }
370 10 46 @_ == 1 ? :
382 0 51 if exists $arg->{'PeerAddr'} and not exists $arg->{'PeerHost'}
385 5 46 if exists $arg->{'PeerPort'} and not exists $arg->{'PeerService'}
388 0 51 if exists $arg->{'LocalAddr'} and not exists $arg->{'LocalHost'}
391 11 40 if exists $arg->{'LocalPort'} and not exists $arg->{'LocalService'}
397 43 59 if (defined $arg->{$host})
400 10 33 if defined $s
418 0 10 if (defined $listenqueue and defined $arg->{'PeerHost'} || defined $arg->{'PeerService'} || defined $arg->{'PeerAddrInfo'})
423 2 33 if (defined $arg->{'GetAddrInfoFlags'}) { }
430 3 32 if (defined(my $family = $arg->{'Family'}))
434 19 16 if (defined(my $type = $arg->{'Type'}))
438 0 35 if (defined(my $proto = $arg->{'Proto'}))
439 0 0 unless ($proto =~ /^\d+$/)
443 0 0 unless defined $protonum
452 16 0 unless (defined $hints{'socktype'} or defined $hints{'protocol'})
459 0 35 if (not defined $hints{'socktype'} and defined $hints{'protocol'})
460 0 0 if $hints{'protocol'} == 6
461 0 0 if $hints{'protocol'} == 17
464 1 34 if (my $info = $arg->{'LocalAddrInfo'}) { }
21 13 elsif (defined $arg->{'LocalHost'} or defined $arg->{'LocalService'} or 0) { }
465 0 1 unless ref $info eq 'ARRAY'
475 0 21 unless (defined $host or defined $service)
480 1 20 if defined $service and $service =~ s/\((\d+)\)$//
487 1 20 if ($err and defined $fallback_port)
491 5 16 if ($err)
498 1 29 if (my $info = $arg->{'PeerAddrInfo'}) { }
10 19 elsif (defined $arg->{'PeerHost'} or defined $arg->{'PeerService'}) { }
499 0 1 unless ref $info eq 'ARRAY'
503 0 10 unless defined(my $host = $arg->{'PeerHost'})
505 0 10 unless defined(my $service = $arg->{'PeerService'})
509 0 10 if defined $service and $service =~ s/\((\d+)\)$//
514 0 10 if ($err and defined $fallback_port)
518 0 10 if ($err)
528 1 29 if $arg->{'ReuseAddr'}
529 1 29 if $arg->{'ReusePort'}
530 1 29 if $arg->{'Broadcast'}
532 1 29 if (my $sockopts = $arg->{'Sockopts'})
533 0 1 unless ref $sockopts eq 'ARRAY'
535 0 1 unless ref $_ eq 'ARRAY'
536 0 1 unless @$_ >= 2 and @$_ <= 3
542 1 0 unless defined $value
548 27 3 unless defined $blocking
555 0 30 if (defined $arg->{'MultiHomed'} and not $arg->{'MultiHomed'})
560 17 13 @localinfos ? :
561 11 19 @peerinfos ? :
563 0 17 if defined $local->{'family'} and defined $peer->{'family'} and $local->{'family'} != $peer->{'family'}
565 0 17 if defined $local->{'socktype'} and defined $peer->{'socktype'} and $local->{'socktype'} != $peer->{'socktype'}
567 0 17 if defined $local->{'protocol'} and defined $peer->{'protocol'} and $local->{'protocol'} != $peer->{'protocol'}
569 2 28 unless my $family = $local->{'family'} || $peer->{'family'}
570 0 28 unless my $socktype = $local->{'socktype'} || $peer->{'socktype'}
583 2 28 unless (@infos)
585 1 1 if (defined $hints{'family'}) { }
596 0 1 if ($err)
624 0 30 unless $self->setup or not $blocking
635 1 30 if do { *$self }->{'io_socket_ip_idx'} >= @{do { *$self }->{'io_socket_ip_infos'};}
640 0 30 unless $self->socket(@{$info;}{'family', 'socktype', 'protocol'})
642 3 27 unless do { *$self }->{'io_socket_ip_blocking'}
646 0 4 unless $self->setsockopt($level, $optname, $value)
649 0 0 if (defined do { *$self }->{'io_socket_ip_v6only'} and defined $AF_INET6 and $info->{'family'} == $AF_INET6)
651 0 0 unless $self->setsockopt(41, 26, pack('i', $v6only))
654 17 13 if (defined(my $addr = $info->{'localaddr'}))
656 0 17 unless $self->bind($addr)
659 10 20 if (defined(my $listenqueue = do { *$self }->{'io_socket_ip_listenqueue'}))
660 0 10 unless $self->listen($listenqueue)
663 11 19 if (defined(my $addr = $info->{'peeraddr'}))
664 8 3 if ($self->connect($addr))
669 3 0 if ($! == 115 or $! == 11)
679 0 0 unless $!
704 13 5 if (@_)
711 12 1 unless defined $timeout
715 0 1 defined CORE::connect($self, $addr) ? :
717 0 1 if (not $err) { }
0 1 elsif (not $err == 115 || $err == 11) { }
0 1 elsif (not $was_blocking) { }
733 0 1 unless (select undef, $vec, $vec, $timeout)
741 0 1 if $err == 106
745 0 1 if $err
749 0 5 unless do { *$self }->{'io_socket_ip_connect_in_progress'}
752 1 4 if (my $errno = $self->getsockopt(1, 4))
764 2 2 if (CORE::connect $self, $addr or $! == 106) { }
795 6 43 unless defined $addr
798 16 27 if $self->socktype == 2
801 0 43 if $err
811 8 0 if ($family == 2) { }
0 0 elsif (defined $AF_INET6 and $family == $AF_INET6) { }
842 0 0 $numeric ? :
895 0 0 $numeric ? :
936 0 5 unless my($new, $peer) = $self->SUPER::accept(@_)
940 0 5 wantarray ? :
949 31 2 unless defined $self->fileno
952 0 2 unless CORE::socket my $tmph, $_[0], $_[1], $_[2]
954 0 2 unless dup2($tmph->fileno, $self->fileno)
960 0 22 if (eval $IO::Socket::VERSION < 1.35)
964 0 0 unless (defined $type)
990 0 1 unless $self->sockdomain == 2
1121 17 30 if ($addr =~ /\A\[($IPv6_re)\](?::([^\s:]*))?\z/ or $addr =~ /\A([^\s:]*):([^\s:]*)\z/)
1123 13 4 if defined $2 and length $2
1149 1 3 if $host =~ /:/
1151 3 1 if defined $port