Branch Coverage

blib/lib/Atomic/Pipe.pm
Criterion Covered Total %
branch 251 346 72.5


line true false branch
13 74 0 if (eval { do { require IO::Select; 1 } }) { }
30 74 0 if "Errno"->can("ERESTART")
34 74 0 if "Errno"->can("EWOULDBLOCK")
41 74 0 if ('POSIX'->can('PIPE_BUF') and eval { do { &POSIX::PIPE_BUF() } }) { }
48 74 0 if ('POSIX'->can('SSIZE_MAX') and eval { do { &POSIX::SSIZE_MAX() } }) { }
68 0 0 if ($can_thread and $] == "5.01" and $Atomic::Pipe::Config{'ccname'} eq "gcc" and $Atomic::Pipe::Config{'gccversion'})
70 0 0 if $parts[0] > 4 or $parts[0] == 4 and $parts[1] >= 8
75 74 0 if (not $can_thread) { }
0 0 elsif ($INC{'threads.pm'}) { }
82 0 0 $INC{'threads.pm'} ? :
85 0 74 if ($^O eq 'MSWin32') { }
87 0 0 unless eval { do { require Win32::API; 1 } }
88 0 0 unless eval { do { require Win32API::File; 1 } }
126 22 0 @_ ? :
132 0 0 if @_
138 27 168578 if (@_)
139 0 27 if $_[0] and Deparse error: Can't locate object method "object_2svref" via package "B::SPECIAL" at /usr/local/lib/perl5/5.42.0/B/Deparse.pm line 5762.
140 16 11 $_[0] ? :
141 11 16 unless $_[0]
145 144344 24194 $val ? :
168538 67 defined $val ? :
152 4 6 $_[0]{'keep_compressed'} ? :
157 0 168799 if $self->{'invalid_state'}
159 0 168799 unless my $rh = $self->{'rh'}
161 221 168578 if $self->{'eof'}
169 144395 24183 if ($use_select) { }
172 144120 275 $blocking ? :
173 184 144211 unless @ready
179 0 168394 unless $to_read
184 97 168297 unless (defined $got)
185 97 0 if $NONBLOCK_ERRNO{0 + $!}
186 0 0 if ($RETRY_ERRNO{0 + $!})
187 0 0 unless $use_select
193 168248 49 if ($got) { }
214 168181 5432666 unless ($self->{'in_buffer_size'} and $self->{'in_buffer_size'} >= $size)
216 7 168174 unless ($self->{'in_buffer_size'} >= $size)
217 7 0 unless $params{'eof_invalid'} and $self->{'eof'}
224 5600772 68 if ($params{'remove'}) { }
247 4 6 if (defined(my $path = $self->{'compression_dictionary_file'}))
256 4 6 if (defined(my $path = $self->{'compression_dictionary_file'}))
264 10 39 if ($self->_has_dict)
276 12 39 if ($self->_has_dict) { }
285 6 45 unless defined $out
292 14 507 if $self->{'invalid_state'}
294 64 443 if $self->fill_buffer
295 232 211 unless $self->{'eof'}
296 60 151 if $self->{'in_buffer_size'}
298 151 0 if (my $buffer = $self->{'mixed_buffer'})
299 49 102 if defined $buffer->{'lines'} and length $buffer->{'lines'}
300 1 101 if defined $buffer->{'burst'} and length $buffer->{'burst'}
311 4 4 if $mode == 0
312 4 0 if $mode == 1
331 0 228 if $params{'use_io_select'} and Deparse error: Can't locate object method "object_2svref" via package "B::SPECIAL" at /usr/local/lib/perl5/5.42.0/B/Deparse.pm line 5762.
333 41 187 if (defined(my $algo = $params{'compression'}))
334 4 37 unless $algo eq "zstd"
336 0 37 unless eval { do { require Compress::Zstd; 1 } }
340 2 222 if defined $params{'compression_dictionary'} and defined $params{'compression_dictionary_file'}
344 4 218 if defined $params{'compression_dictionary'} || defined $params{'compression_dictionary_file'} and not defined $params{'compression'}
352 0 22 unless -p $fifo
354 0 22 unless open my $fh, "+<", $fifo
365 0 13 unless -p $fifo
367 0 13 unless open my $fh, ">", $fifo
378 10 4 if @_ and not ref $_[0] and $MODE_TO_DIR{$_[0]}
384 0 13 unless -p $ifh
389 0 13 unless open my $fh, $mode, $ifh
402 0 11 unless open my $fh, $mode, $fd
404 0 11 unless -p $fh
416 111 262 if $mixed
428 0 4 unless pipe $rh, $wh
443 0 155 unless pipe $rh, $wh
457 0 111 if $self->{'invalid_state'}
459 56 55 if $self->{'rh'}
470 6 10 unless (defined $algo)
481 2 8 unless $algo eq "zstd"
483 0 8 unless eval { do { require Compress::Zstd; 1 } }
488 2 6 if defined $level
502 4 0 if (defined $bytes) { }
504 0 4 unless defined $self->{'compression'}
519 4 4 if (defined $path) { }
521 0 4 unless defined $self->{'compression'}
536 2 2 $val ? :
562 6 48 if $self->eof and keys %{$$self{'state'}{'buffers'};} || keys %{$$self{'state'}{'parts'};}
564 194 176 if ($buffer->{'lines'} or length $buffer->{'lines'})
569 52 142 if $term
570 24 0 if $self->{'eof'} and not $self->{'in_buffer_size'} and defined $line and length $line
573 4 0 if $params{'peek_line'} and defined $line and length $line
576 40 254 if ($buffer->{'in_message'})
579 0 40 unless (defined $id)
580 0 0 unless $self->{'eof'} and not $self->{'in_buffer_size'}
586 14 26 if (defined $message)
587 4 10 if ($self->{'compression'})
591 2 2 if $self->{'keep_compressed'}
598 38 242 if ($buffer->{'strip_term'})
601 0 38 unless $term eq $postfix
605 68 212 if ($buffer->{'in_burst'})
608 40 28 if ($peek eq $key)
620 20 8 if ($term) { }
624 8 12 if ($self->{'compression'})
627 2 6 if $self->{'keep_compressed'}
636 8 0 if $self->{'eof'}
639 96 116 unless ($self->{'in_buffer_size'} or $self->fill_buffer)
640 4 92 if $peek and not $self->{'eof'}
642 38 54 unless $self->{'eof'}
645 24 30 if $buffer->{'eof'}++
654 116 0 if defined $linedata
656 68 48 if ($buffer->{'in_burst'}) { }
684 0 0 if $ret == 0
699 0 0 $state ? :
708 0 74 unless my $rh = $self->{'rh'}
710 74 0 if @_
721 0 24 unless my $wh = $self->{'wh'}
723 0 24 unless @_
733 0 24 unless defined $flags
734 5 19 if ($val) { }
736 0 24 unless fcntl $wh, &Fcntl::F_SETFL, $flags
745 15 22 if ($self->{'rh'} and not $self->{'wh'}) { }
21 1 elsif ($self->{'wh'} and not $self->{'rh'}) { }
755 0 1 if $r and $w
756 1 0 unless $r or $w
762 0 2 unless defined &Fcntl::F_GETPIPE_SZ
771 0 10 unless defined &Fcntl::F_SETPIPE_SZ
782 0 3 unless -e "/proc/sys/fs/pipe-max-size"
784 0 3 unless open my $max, "<", "/proc/sys/fs/pipe-max-size"
803 9 0 if $self->{'rh'} and not $self->{'wh'}
809 8 0 if $self->{'wh'} and not $self->{'rh'}
816 0 6 unless open my $fh, ">&:raw", $self->{'wh'}
823 0 0 unless open my $fh, "<&:raw", $self->{'rh'}
830 0 0 unless $self->{'wh'}
832 0 0 unless $self->{'rh'}
841 0 3 unless $self->{'rh'}
843 0 3 unless $self->{'wh'}
855 0 45 if $self->{'hit_epipe'} or $self->{'invalid_state'}
856 2 43 if $self->pending_output
861 42 2 if ($self->{'wh'})
865 2 42 if $self->{'rh'}
873 0 109 if defined $_[0]{'delimiter_size'}
883 1 12 if $cache and $cache->[0] eq $data
894 5 8 if $self->{'compression'}
897 2 11 unless $size <= 4096
906 8 19757 if $self->{'compression'}
909 2 19763 unless $size <= 4096
920 24 352 if $self->{'hit_epipe'} or $self->{'invalid_state'}
921 2 350 if $self->{'wh'} and $self->pending_output
926 95 19846 unless my $buffer = $self->{'out_buffer'}
927 19837 9 unless @$buffer
942 254 819985 unless $blocking or defined $got
943 2 819983 unless defined $got
955 0 820243 unless my $wh = $self->{'wh'}
957 2 820241 if $self->{'hit_epipe'}
962 22 820219 if length $prefix or length $postfix
969 258 819983 unless (defined $wrote)
970 2 256 if ($! == 32 or 0)
975 254 2 if $NONBLOCK_ERRNO{0 + $!} or 0
976 0 2 if $RETRY_ERRNO{0 + $!}
980 0 819983 unless $wrote
981 819983 0 if $wrote == $size
991 0 94 if defined $self->{'adjusted_dsize'}
1005 33 200091 if $self->{'compression'}
1013 200124 0 if $dtotal % $adjusted_dsize
1018 77 200047 if ($parts == 1) { }
1023 4 73 $message_key ? :
1049 6 700173 unless defined $id
1051 700142 31 unless $self->{'compression'}
1053 4 27 if ($params{'debug'})
1056 2 2 if $self->{'keep_compressed'}
1063 2 23 if $self->{'keep_compressed'} and wantarray
1074 2800354 0 unless ($state->{'key'})
1076 7 2800347 unless (defined $key_bytes and length $key_bytes)
1081 1 1 if $self->{'eof'} and $self->{'in_buffer_size'}
1097 2100154 700193 $state->{'buffers'}{$tag} ? :
1101 2100160 700187 unless ($id == 0)
1102 26 2100134 if $params{'one_part_only'}
1109 700174 13 unless $params{'debug'}