Branch Coverage

blib/lib/Net/Gen.pm
Criterion Covered Total %
branch 199 452 44.0


line true false branch
170 0 12 if (exists $Net::Gen::_missing{$Net::Gen::AUTOLOAD})
172 0 0 if $wh and ref $wh eq 'CODE' and $wh == $nullsub
176 0 12 if (@_ and ref $_[0] and @_ < 3 and exists ${*{$_[0];};}{'Keys'}{$constname})
179 0 0 if $Net::Gen::adebug
186 0 12 if $Net::Gen::adebug
223 0 4 if @_ != 3 or ref $opts ne 'HASH'
230 0 4 if ref $class
236 14 48 if exists $Net::Gen::_missing{"${class}::$opt"}
238 0 48 if $@ or not defined $oval or $oval eq ''
309 0 0 if ref $this
312 0 0 if defined $newval
320 347 0 if defined wantarray
321 0 347 if defined $newval
331 169 22 unless defined $msg
332 0 0 unless $aref
0 191 if $level and $this->_debug >= $level
341 0 8 unless defined $val
342 0 8 if $val eq '' or $val =~ /\D/
359 0 0 if @_ > 3
361 0 0 if defined wantarray
362 0 0 if @_ > 2
370 0 19 unless defined $newval
373 0 19 unless defined ${*$self;}{'Parms'}{$what}
374 17 2 if ($newval) { }
376 9 8 if (defined $F_GETFL and defined $F_SETFL and defined $nonblock_flag and $self->isopen)
379 2 7 if ((CORE::fcntl($self, $F_GETFL, 0) & 2048) == 2048)
384 0 2 unless eval { do { CORE::fcntl $self, $F_SETFL, CORE::fcntl($self, $F_GETFL, 0) & 18446744073709549567 } }
392 0 2 unless (defined $F_GETFL and defined $F_SETFL and defined $nonblock_flag)
397 2 0 if ($self->isopen)
398 2 0 if ((CORE::fcntl($self, $F_GETFL, 0) & 2048) != 2048)
403 0 2 unless eval { do { CORE::fcntl $self, $F_SETFL, CORE::fcntl($self, $F_GETFL, 0) | 2048 } }
416 0 1 if @_ > 2
418 1 0 if defined wantarray
419 0 1 if @_ > 1
427 0 3 unless (defined $newval)
430 0 3 if (not length $newval or $newval =~ /\D/) { }
456 0 5 if @_ != 2 or ref $names ne 'ARRAY'
472 5 0 if (ref $names eq 'HASH') { }
473 0 5 if @_ != 2
479 0 0 if @_ < 3 or ref $names ne 'ARRAY'
482 0 0 if @_ == 3 and ref $_[2] eq 'ARRAY'
484 0 5 if @$handlers != @$names or grep((ref $_ ne 'CODE'), @$handlers)
498 0 3 if ref $opts ne 'HASH'
538 1 6 if $parms and ref $parms eq 'HASH'
539 7 0 unless defined $parms{'debug'}
540 7 0 unless defined $parms{'blocking'}
541 0 1 if (@_ > 2 and $parms and ref $parms eq 'HASH')
549 5 2 if (%Keys) { }
560 0 7 if ($class eq 'Net::Gen')
561 0 0 unless ($self->init)
567 0 7 if (($self || $pack)->_debug)
568 0 0 if (defined $self) { }
584 0 60 unless @_ > 1 and ref $newparams eq 'HASH'
586 0 60 if @_ > 4
592 0 0 defined $newval ? :
0 167 if $self->debug
597 0 167 unless exists ${*$self;}{'Keys'}{$parm}
599 5 162 if $newonly < 0 and defined $$pslot
600 83 79 unless ($check)
604 2 5 if defined $$pslot eq defined $newval and !defined($newval) || $$pslot eq $newval || !($$pslot =~ /\D/ || $newval =~ /\D/) && length $newval && length $$pslot && $$pslot == $newval
615 0 160 if $newonly > 0 and defined $$pslot
618 43 117 if (defined ${*$self;}{'Keys'}{$parm} and ref ${*$self;}{'Keys'}{$parm} eq 'CODE')
622 0 43 if $rval
628 0 60 $errs ? :
639 3 5 unless @k
641 0 5 unless $self->setparams(\%k)
651 0 8 if @_
654 0 8 unless ref $curparms eq 'HASH'
670 7 0 $self->checkparams ? :
678 0 36 if @_ > 4
680 16 20 if ($noundef) { }
681 1 15 unless defined ${*$self;}{'Parms'}{$key}
684 4 16 unless exists ${*$self;}{'Parms'}{$key}
694 0 17 if @_ < 2 or not ref $self or ref $aref ne 'ARRAY'
696 0 17 if @_ > 3
698 0 17 unless defined wantarray
699 2 15 if (wantarray) { }
701 0 2 if ($noundef) { }
703 0 0 defined ${*$self;}{'Parms'}{$_} ? :
709 2 0 exists ${*$self;}{'Parms'}{$_} ? :
716 15 0 if ($noundef) { }
751 0 6 if $self->isopen
753 0 6 unless defined $$pf
754 0 6 unless defined $$af
755 0 6 unless defined $$type
756 4 2 unless defined $$proto
757 0 6 if ($$pf == 0 and $$af != 0) { }
0 12 elsif ($$af == 0 and $$pf != 0) { }
763 6 0 if (${*$self;}{'isopen'} = socket($self, $$pf, $$type, $$proto))
783 0 0 unless defined $timeout or ${*$self;}{'Parms'}{'blocking'}
788 0 0 if $nfound
791 0 0 unless ($nfound)
798 0 0 if (${*$self;}{'Sockopts'}{'SOL_SOCKET'}{'SO_ERROR'})
804 0 0 unless defined $rval
806 0 0 if ($rval)
810 0 0 unless defined getpeername $self
819 0 0 if ($type and $type == 1)
822 0 0 unless defined $rval
826 0 0 unless defined getpeername $self
828 0 0 if $rval
829 0 0 if $connok{0 + $!}
837 0 2 if (${*$self;}{'isconnecting'})
838 0 0 if (${*$self;}{'Parms'}{'dstaddr'} and ${*$self;}{'Parms'}{'dstaddr'} ne $addr)
842 0 0 if ${*$self;}{'Parms'}{'debug'} > 2
844 0 0 unless $self->open
845 0 0 if ($self->getparam('srcaddr') || $self->getparam('srcaddrlist') and not $self->isbound)
848 0 0 unless $self->bind
856 2 0 unless (${*$self;}{'isconnecting'})
858 1 1 if (${*$self;}{'Parms'}{'netgen_fakeconnect'})
859 1 0 if (not $self->isbound) { }
868 1 0 if $rval
869 0 0 if $connok{0 + $!}
870 0 0 unless $connip{0 + $!}
873 0 0 unless defined $timeout
885 0 2 if $$hval{'isconnected'} or not $$hval{'isconnecting'} and $$hval{'wasconnected'}
888 0 2 unless $self->isopen or $self->open
889 0 0 if ($$parms{'srcaddr'} || $$parms{'srcaddrlist'} and not $$hval{'isconnecting'} and not $self->isbound)
892 0 0 unless $self->bind
898 1 1 if (defined($timeout = $$parms{'timeout'}) and $self->blocking)
900 0 1 unless $self->setparams({'blocking', 0})
903 2 0 if (defined $dlist and ref $dlist eq 'ARRAY' and not $$hval{'isconnecting'}) { }
910 2 0 if $rval
911 2 0 if $rval or defined $timeout and not $timeout and $connip{0 + $!}
919 0 2 unless $rval
923 0 2 unless ($rval)
938 2 5 if defined($dad = getpeername $self)
939 7 0 if defined($sad = getsockname $self)
941 2 0 defined $sad || defined $dad ? :
2 5 wantarray ? :
956 2 3 unless $self->isconnected or $self->isconnecting
958 0 0 unless defined $how and not $how =~ /\D/ and length $how
961 0 3 unless $xhow
968 3 0 if $was == 3 or not defined getpeername $self and ${*$self;}{'wasconnected'} = 3
982 5 0 if $self->isopen
997 1 5 unless $wasopen
1014 0 6 if @_ < 2 or not ref $self
1016 5 1 unless defined $flags
1017 0 6 if @_ > 4
1019 2 4 if (not defined $whither || $self->isconnected) { }
1 4 elsif ($self->isconnected and ${*$self;}{'Parms'}{'netgen_fakeconnect'}) { }
1020 0 2 if ($self->getparams(['dstaddrlist', 'dstaddr'], 1) > 0) { }
1021 0 0 unless $self->connect
1022 0 0 if (${*$self;}{'Parms'}{'netgen_fakeconnect'})
1027 0 2 if ($flags & 1) { }
1038 0 1 if (defined $whither)
1045 0 6 unless $self->isopen
1047 4 2 defined $whither ? :
1075 0 0 unless @_ and ref $self
1080 0 0 unless unpack('I', getsockopt($self, 1, 3)) == 1
1083 0 0 $F_GETFL ? :
1084 0 0 defined $flags && defined $nonblock_flag ? :
0 0 if (defined $flags && defined $nonblock_flag ? $flags & 2048 : 1)
1100 0 5 unless @_ and ref $self
1102 0 5 if @_ > 4
1104 0 5 unless $self->isopen or $self->open
1106 2 3 unless $maxlen
1109 3 2 unless defined $flags
1110 0 5 if (defined ${*$self;}{'sockLineBuf'} and not $flags)
1112 0 0 if (length $buf > $maxlen) { }
1119 0 0 if @_ > 3
1125 2 3 if defined $from and $from eq ''
1126 1 3 if defined $xfrom and $from eq '' and $xfrom ne ''
1128 2 3 if @_ > 3
1129 0 5 if ($flags & 1) { }
1136 0 5 if not defined $from and 1
1137 5 0 if length $buf
1141 0 0 unless ($self->ckeof)
1142 0 0 defined $from ? :
1156 0 2 if @_ > 1
1159 0 2 unless @_ and ref $self
1164 0 2 unless (defined $/)
1169 0 0 if (defined $buf and defined $rval)
1172 0 0 if (defined $buf)
1178 0 2 if $sep eq ''
1181 0 2 unless defined $rval
1182 0 2 if (defined $buf) { }
1189 2 0 if (defined $buf and ($tbuf = index($buf, $sep)) >= 0) { }
1193 0 2 if $/ eq ''
1194 0 2 if length $tbuf
2802 0 3 if $self->wasconnected or $self->isconnected or $self->isconnecting or $self->isbound
2805 0 3 unless $self->isopen or $self->open
2807 2 1 if ${*$self;}{'Parms'}{'reuseaddr'}
2808 0 3 if ${*$self;}{'Parms'}{'reuseport'}
2810 3 0 if (${*$self;}{'Parms'}{'srcaddrlist'}) { }
0 0 elsif (defined ${*$self;}{'Parms'}{'srcaddr'} and length ${*$self;}{'Parms'}{'srcaddr'}) { }
2813 0 3 unless $rval = CORE::bind($self, $tryaddr)
2827 0 3 unless $rval
2853 1 0 unless defined $maxq
2854 0 1 if $maxq =~ /\D/ or not ref $self
2856 0 1 if @_ > 2
2857 0 1 unless $self->isbound or $self->bind
2859 0 1 unless CORE::listen $self, $maxq
2899 0 2 if ($level =~ /^(0x[\da-f]+|0[0-7]*|[1-9]\d*)$/is)
2901 0 0 substr($level, 0, 1) eq '0' ? :
2904 2 0 if (not $aref) { }
0 0 elsif (ref $aref eq 'HASH') { }
2909 0 0 unless $realp
2911 0 0 unless $what =~ /^(0x[\da-f]+|0[0-7]*|[1-9]\d*)$/is
2912 0 0 substr($what, 0, 1) eq '0' ? :
2916 0 2 unless $level =~ /\D/
2919 0 2 unless ref ${*$self;}{'Sockopts'}{$level} eq 'HASH'
2920 2 0 if $aref = ${*$self;}{'Sockopts'}{$level}{$what}
2922 2 0 if ref $aref eq 'ARRAY'
2926 0 0 if ($what =~ /^(0x[\da-f]+|0[0-7]*|[1-9]\d*)$/is)
2927 0 0 substr($what, 0, 1) eq '0' ? :
2932 0 2 unless ref $aref eq 'ARRAY'
2978 0 2 unless $aref = shift @args
2982 0 2 if ($realp) { }
2987 0 2 if @args > $$aref[3]
2989 0 0 unless length $rval or $$aref[3]
2991 0 2 if $self->debug > 3
3046 0 3 unless $self->isopen and defined CORE::fileno $self
3058 0 2 unless $fhvec
3059 2 0 $doread ? :
3060 0 2 $dowrite ? :
3061 0 2 $doxcept ? :
3062 0 2 if $doread and defined ${*$self;}{'sockLineBuf'}
3063 0 2 unless ($nfound, $timeleft) = CORE::select($rvec, $wvec, $xvec, $timer)
3065 0 0 if (defined ${*$self;}{'sockLineBuf'} and $doread and $rvec ne $fhvec)
3070 0 2 wantarray ? :
3174 0 1 if @_ > 1
3175 0 1 unless $self->didlisten or $self->listen
3177 0 1 unless $ns
3184 1 0 if (defined $timeout and ${*$self;}{'Parms'}{'blocking'})
3189 0 1 unless (CORE::accept $ns, $self)
3201 0 1 unless ($ns->isconnected)