Branch Coverage

blib/lib/IO/Async/Stream.pm
Criterion Covered Total %
branch 153 198 77.2


line true false branch
393 826 17048 if exists $params{$_}
396 1 992 if (exists $params{'read_high_watermark'} or exists $params{'read_low_watermark'})
400 0 1 if defined $low and not defined $high
401 0 1 if defined $high and not defined $low
403 0 1 if defined $low and defined $high and $low > $high
411 2 991 if (exists $params{'encoding'})
414 0 2 unless defined $obj
420 5 988 if ($self->loop and $self->read_handle)
421 0 5 unless $self->can_event("on_read")
425 62 931 if ($self->{'autoflush'} and my $write_handle = $self->write_handle)
426 0 62 if $write_handle->blocking
435 592 111 if (defined $self->read_handle)
436 1 591 unless $self->can_event("on_read")
442 39 663 if (not $self->_is_empty)
479 0 0 $set ? :
481 0 0 if $self->read_handle
488 1 0 $set ? :
490 1 0 if $self->read_handle
518 67 154 $set ? :
520 201 20 if $self->write_handle
527 1 0 $set ? :
529 1 0 if $self->write_handle
585 165 8 if $self->_is_empty
605 1 1 if $_->on_error
739 8 156 unless $written
753 12 6 if (ref $head->data eq 'CODE') { }
6 0 elsif (builtin::blessed($head->data) and $head->data->isa('Future')) { }
755 5 7 unless (defined $data)
756 5 0 if $head->on_flush
760 1 6 if (not ref $data and my $encoding = $self->{'encoding'})
770 2 4 unless ($f->is_ready)
771 0 2 if $head->watching
777 1 3 if (not ref $data and my $encoding = $self->{'encoding'})
800 0 168 if ref $head->data
802 0 168 if ($IO::Async::Debug::DEBUG > 1)
805 0 0 if $IO::Async::Debug::DEBUG_FLAGS{'Sw'}
811 3 165 unless (defined $len)
814 1 2 if ($errno == 11 or $errno == 11)
815 1 0 if $self->{'writeable'}
819 1 2 if _nonfatal_error($errno)
821 0 2 if $IO::Async::Debug::DEBUG > 1
823 1 1 if ($errno == 32)
829 2 0 if $head->on_error
830 1 1 unless $self->maybe_invoke_event("on_write_error", $errno)
836 159 6 if $len
838 3 162 if (my $on_write = $head->on_write)
842 155 10 unless (length $head->data)
843 34 121 if $head->on_flush
855 0 167 if $self->{'stream_closing'}
861 1 166 if not $handle and $self->loop
863 2 164 if (not ref $data and my $encoding = $self->{'encoding'})
872 3 163 if (defined wantarray)
876 0 3 unless my $loop = $self->loop
881 1 0 if $orig_on_flush
887 2 1 unless $f->is_ready
889 0 3 if $orig_on_error
899 0 166 if keys %params
901 36 130 unless $handle
903 102 28 if ($self->{'autoflush'})
906 102 0 if ($self->_is_empty)
920 1 67 unless ($self->{'writeable'})
925 67 1 if $self->{'want'} & 8
926 1 67 if $self->{'want'} & 4
936 51 17 if ($self->_is_empty)
941 8 43 if $self->{'stream_closing'}
955 17 1133 if ($readqueue->[0] and my $on_read = $readqueue->[0]->on_read) { }
962 1 2 if (defined $self->{'read_low_watermark'} and $self->{'at_read_high_watermark'} and length $self->{'readbuff'} < $self->{'read_low_watermark'})
968 1 1149 if (ref $ret eq 'CODE') { }
13 1136 elsif (@$readqueue and not defined $ret) { }
993 940 0 if $self->{'want'} & 1
994 1 939 if $self->{'want'} & 2
1008 6 939 unless (defined $len)
1011 2 4 if _nonfatal_error($errno)
1013 0 4 if $IO::Async::Debug::DEBUG > 1
1015 2 2 unless $self->maybe_invoke_event("on_read_error", $errno)
1019 1 0 if $_->future
1026 0 939 if ($IO::Async::Debug::DEBUG > 1)
1028 0 0 if $IO::Async::Debug::DEBUG_FLAGS{'Sr'}
1031 463 476 if $len
1035 4 935 if (my $encoding = $self->{'encoding'})
1036 3 1 defined $self->{'bytes_remaining'} ? :
1041 463 476 unless $eof
1045 476 463 if ($eof)
1048 467 9 if $self->{'close_on_read_eof'}
1050 0 0 if $_->future
1056 459 4 unless $self->{'read_all'}
1059 1 458 if (defined $self->{'read_high_watermark'} and length $self->{'readbuff'} >= $self->{'read_high_watermark'})
1061 1 0 unless $self->{'at_read_high_watermark'}
1107 1 12 if $self->{'flushing_read'}
1160 0 1 unless my $self = shift()
1189 0 1 if $f->is_cancelled
1204 0 4 if $f->is_cancelled
1205 0 4 unless $eof or length $$buffref >= $len
1227 3 1 unless ref $until
1232 1 4 if $f->is_cancelled
1233 3 1 if ($$buffref =~ /$until/u) { }
0 1 elsif ($eof) { }
1264 0 2 if $f->is_cancelled
1265 1 1 unless $eof