Branch Coverage

lib/HTTP/Promise/IO.pm
Criterion Covered Total %
branch 115 408 28.1


line true false branch
46 0 60 unless scalar @_
48 0 60 unless $self->_is_glob($fh)
58 0 60 unless $self->SUPER::init(@_)
62 60 0 if ($self->_can($fh, 'fcntl')) { }
65 0 60 unless defined $flags
67 0 60 unless defined $rv
72 0 0 unless defined $flags
74 0 0 unless defined $rv
87 0 158 unless defined fileno $fh
88 0 158 if $fh->isa("IO::Socket::SSL") and $fh->pending
89 0 0 if $fh->isa("Net::SSL") and $fh->can("pending") and $fh->pending
93 40 118 if (fileno $fh == -1)
95 40 0 if ($self->_can($fh, 'can_read')) { }
102 0 0 if ($self->_can($fh, 'fcntl')) { }
110 0 0 unless defined $flags
117 0 118 $opts->{'timeout'} ? :
124 118 0 if $timeout
126 0 118 if ($nfound < 0)
128 0 0 if ($!{'EINTR'} or $!{'EAGAIN'} or $!{'EWOULDBLOCK'})
131 0 0 if ($timeout)
134 0 0 if $timeout < 0
148 0 0 if $self->_can($fh, "close")
159 0 0 unless $port =~ /^\d+$/
160 0 0 unless exists $opts->{'timeout'} and length $opts->{'timeout'}
163 0 0 $self->_is_code($opts->{'stop_if'}) ? :
170 0 0 if defined $timeout and $timeout > 0
177 0 0 if $@ =~ /timeout/i
180 0 0 if exists $opts->{'local_port'} and defined $opts->{'local_port'}
183 0 0 defined $opts->{'local_host'} ? :
184 0 0 unless defined $laddr
186 0 0 if (defined $lport or $laddr ne "\0\0\0\0")
192 0 0 unless (bind $sock, $local_sock_addr)
193 0 0 if ($laddr ne "\000\000\000\000") { }
205 0 0 unless socket $sock, Socket::sockaddr_family($sock_addr), 1, 0
207 0 0 unless $self->_set_sockopts($sock)
209 0 0 if ($self->_is_array($HTTP::Promise::IO::INIT_PARAMS))
213 0 0 if exists $opts->{$_}
217 0 0 if (CORE::connect $sock, $sock_addr) { }
0 0 elsif ($! == 115 or $HTTP::Promise::IO::IS_WIN32 and $! == 11) { }
224 0 0 unless defined $rv
225 0 0 unless $rv
230 0 0 if ($! == 4 and not &$stop_if())
249 0 0 unless $port =~ /^\d+$/
250 0 0 unless exists $opts->{'timeout'} and length $opts->{'timeout'}
252 0 0 unless $self->_load_class("IO::Socket::SSL")
255 0 0 if ($self->_is_array($HTTP::Promise::IO::INIT_PARAMS))
259 0 0 if exists $opts->{$_}
279 0 0 defined $opts->{'local_host'} ? :
0 0 defined $opts->{'local_port'} ? :
0 0 unless "IO::Socket::SSL"->start_SSL($sock, "PeerHost", $host, "PeerPort", $port, "Timeout", $timeout, defined $opts->{'local_host'} ? ("LocalHost", $opts->{'local_host'}) : (), defined $opts->{'local_port'} ? ("LocalPort", $opts->{'local_port'}) : (), %$ssl_opts)
294 0 0 unless $proxy_port =~ /^\d+$/
295 0 0 unless $port =~ /^\d+$/
296 0 0 unless $port =~ /^\d+$/
297 0 0 unless exists $opts->{'timeout'} and length $opts->{'timeout'}
299 0 0 unless $self->_load_class("IO::Socket::SSL")
302 0 0 if ($self->_is_array($HTTP::Promise::IO::INIT_PARAMS))
306 0 0 if exists $opts->{$_}
316 0 0 if (defined $proxy_authorization)
321 0 0 $! != 0 ? :
0 0 unless $new->_write_all($sock, $p, $opts->{'timeout'})
328 0 0 if (not defined $read) { }
0 0 elsif ($read == 0) { }
0 0 elsif (not $buf =~ m[^HTTP/1\.[0-9] 200 .+\015\012]) { }
330 0 0 $! != 0 ? :
343 0 0 if $opts->{'timeout'} <= 0
346 0 0 unless (exists $ssl_opts->{'SSL_verifycn_name'})
356 0 0 defined $opts->{'local_host'} ? :
0 0 defined $opts->{'local_port'} ? :
0 0 unless "IO::Socket::SSL"->start_SSL($sock, "PeerHost", "$host", "PeerPort", "$port", "Timeout", "$timeout", defined $opts->{'local_host'} ? ("LocalHost", $opts->{'local_host'}) : (), defined $opts->{'local_port'} ? ("LocalPort", $opts->{'local_port'}) : (), %$ssl_opts)
370 24 0 unless exists $opts->{'chomp'}
376 24 0 $self->_can($fh, 'sysread') ? :
381 23 23 if $pos >= 0
383 0 23 if $max and $buff->length > $max
389 0 23 unless defined $rv
390 0 23 unless $rv
392 23 0 $is_object ? :
395 23 0 if (defined $bytes_read) { }
0 0 elsif ($!{'EINTR'} or $!{'EAGAIN'} or $!{'EWOULDBLOCK'}) { }
408 0 0 unless $buff->length
412 1 0 $buff->length ? :
1 22 if $new_bytes == 0
419 0 23 if $max and $pos > $max
423 0 23 if $opts->{'chomp'}
437 0 0 unless defined $timeout
438 0 0 $opts->{'write'} ? :
442 0 0 if ($is_write) { }
451 0 0 if $nfound < 0 and $!
460 0 0 $opts->{'write'} ? :
463 0 0 if exists $opts->{'timeout'} and length $opts->{'timeout'}
466 0 0 unless defined $timeout
471 0 0 $timeout_at > $inactivity_timeout_at ? :
472 0 0 if $timeout_at > $inactivity_timeout_at
478 0 0 if ($timeout2 <= 0)
484 0 0 unless defined $nfound
485 0 0 if $nfound > 0
486 0 0 if $nfound == -1 and $! == 4 and &$stop_if()
496 237 0 defined((shift())->write(@_)) ? :
501 0 80 unless @_ > 2 and @_ < 5
503 0 80 unless defined $len and $len =~ /^\d+$/
505 0 80 if defined $off and not $off =~ /^-?\d+$/
506 1 79 $self->_is_scalar($_[1]) ? :
507 0 80 if ref $_[1] and not $is_scalar
512 80 0 $self->_can($fh, 'sysread') ? :
519 40 0 @_ > 2 ? :
0 0 @_ > 2 ? :
40 0 $is_object ? :
522 40 0 if (defined $n)
527 0 0 if ($! == 11 or $! == 11 or $HTTP::Promise::IO::IS_WIN32 and $! == 106) { }
0 0 elsif ($! == 4) { }
533 0 0 if &$stop_if()
542 0 0 unless defined $rv
543 0 0 unless $rv
547 61 19 if ($buff_len) { }
550 21 40 if ($buff_len < $len)
552 0 21 unless defined $self->can_read
554 0 21 unless defined $n
558 1 60 $buff->length > $len ? :
563 0 61 if ($is_scalar) { }
565 0 0 if ($off > length $_->[1])
575 0 61 if ($off > length $_[1])
587 19 0 defined $off ? :
594 0 129 unless @_ > 2
596 0 129 unless $len =~ /^\d+$/
597 0 129 if ref $_[1]
598 0 129 $_[3] =~ /^\-?\d+$/ ? :
600 129 0 if ref $_[-1] eq "HASH"
602 0 129 unless defined $what and length $what
603 0 129 unless ref $what eq "Regexp"
606 129 0 unless exists $opts->{'exclude'}
607 129 0 unless exists $opts->{'include'}
613 129 0 if ($opts->{'ignore'}) { }
0 0 elsif ($opts->{'include'}) { }
615 13 116 $opts->{'capture'} ? :
619 0 0 $opts->{'capture'} ? :
626 0 129 if $len > $chunk_size
630 129 0 $self->_can($fh, 'sysread') ? :
633 114 15 unless ($buff_len and $$buff =~ /$re/)
635 114 0 if ($buff_len < $sliding_buffer_size)
637 0 114 unless defined $self->can_read
640 114 0 $is_object ? :
643 0 114 if (not defined $n) { }
1 113 elsif (not $n and $buff->is_empty) { }
645 0 0 if ($! == 11 or $! == 11 or $HTTP::Promise::IO::IS_WIN32 and $! == 106) { }
0 0 elsif ($! == 4) { }
651 0 0 if &$stop_if()
660 0 0 unless defined $rv
661 0 0 unless $rv
682 0 128 if ($off > length $_[1])
687 18 110 if ($$buff =~ s/^$re//) { }
690 13 5 if (exists $+{'__reader_delimiter'}) { }
711 110 0 $buff->length > $len ? :
724 0 42 unless defined $what and length $what
725 0 42 unless ref $what eq "Regexp"
727 41 1 unless exists $opts->{'exclude'}
728 1 41 unless exists $opts->{'include'}
734 0 42 if ($opts->{'ignore'}) { }
41 1 elsif ($opts->{'include'}) { }
736 0 0 $opts->{'capture'} ? :
740 5 36 $opts->{'capture'} ? :
751 39 3 if (my $buff_len = $self->buffer->length)
754 0 39 unless defined $bytes
760 0 3 unless defined $n
761 1 2 unless $n
763 0 2 if ($max and length $buff > $max)
769 41 0 if ($buff =~ s/^$re//) { }
772 5 36 if (exists $+{'__reader_delimiter'}) { }
799 0 355 if @_
807 55 6 if ($buff->is_empty) { }
822 0 237 unless @_ > 1 and @_ < 6
824 0 237 @_ > 2 ? :
825 0 237 @_ > 3 ? :
826 0 237 @_ > 4 ? :
828 237 0 $self->_can($fh, 'syswrite') ? :
831 237 0 $is_object ? :
834 237 0 if (defined $bytes)
838 0 0 if ($! == 11 or $! == 11 or $HTTP::Promise::IO::IS_WIN32 and $! == 106) { }
0 0 elsif ($! == 4) { }
845 0 0 if $self->stop_if->()
853 0 0 unless defined $rv
854 0 0 unless $rv
861 0 0 unless @_ > 1 and @_ < 4
863 0 0 @_ > 2 ? :
868 0 0 unless defined $bytes
869 0 0 unless $bytes
872 0 0 if $len < 0
884 0 0 unless setsockopt $sock, 6, 1, 1
886 0 0 if ($HTTP::Promise::IO::IS_WIN32) { }
888 0 0 if (ref $sock ne "IO::Socket::SSL")
891 0 0 unless ioctl $sock, 2147772030, \$tmp
897 0 0 unless my $flags = fcntl($sock, 3, 0)
899 0 0 unless $flags = fcntl($sock, 4, $flags | 2048)
917 0 0 unless (exists $ssl_opts->{'SSL_verify_mode'})
921 0 0 unless (exists $ssl_opts->{'SSL_verifycn_scheme'})
926 0 0 if ($ssl_opts->{'SSL_verify_mode'})
928 0 0 unless (exists $ssl_opts->{'SSL_ca_file'} or exists $ssl_opts->{'SSL_ca_path'})
930 0 0 unless $self->_load_class("Mozilla::CA")
944 1 0 if (exists $hash{'stop_if'} and defined $hash{'stop_if'} and ref $hash{'stop_if'})
954 0 1 if $serialiser eq "Sereal" and "Sereal::Encoder"->VERSION <= "version"->parse("4.023")
966 0 1 scalar @args == 1 && ref $args[0] eq 'ARRAY' ? :
967 1 0 defined $ref && ref $ref eq 'ARRAY' && scalar @$ref > 1 ? :
968 1 0 ref $ref eq 'ARRAY' ? :
971 1 0 if (ref $self) { }
983 0 0 if (exists $hash->{'stop_if_code'} and defined $hash->{'stop_if_code'} and length $hash->{'stop_if_code'})
996 0 0 if ($@)