Branch Coverage

blib/lib/Crypt/SecretBuffer.pm
Criterion Covered Total %
branch 79 166 47.5


line true false branch
50 3 1 if (@_)
63 42 5 if (@_ and ref $_[0] and ref $_[0] eq 'GLOB' || ref($_[0])->can('getc')) { }
64 0 42 unless @_ & 1
67 0 5 if @_ & 1
76 4 43 defined $state->{'start_len'} ? :
78 43 4 unless defined $state->{'start_len'}
83 59 317 if exists $options{$_}
87 2 45 if $state->{'utf8'}
96 0 47 if keys %options
100 0 47 if (not defined $input_fh) { }
102 0 0 if ($^O eq 'MSWin32') { }
103 0 0 unless open $input_fh, "+<", "CONIN\$"
105 0 0 unless (defined $state->{'prompt_fh'})
106 0 0 unless open $prompt_fh, ">", "CONOUT\$"
111 0 0 unless open $input_fh, "+<", "/dev/tty"
113 0 0 unless (defined $state->{'prompt_fh'})
124 5 42 if (defined $state->{'prompt'} or defined $char_mask)
125 0 5 if (not defined $prompt_fh) { }
131 0 0 if (-t $input_fh and defined $fd && $fd == 0 || \*STDIN == $input_fh || $^O eq 'MSWin32') { }
0 0 elsif (-S $input_fh or -t $input_fh) { }
132 0 0 if ($^O eq 'MSWin32') { }
133 0 0 unless open $prompt_fh, ">", "CONOUT\$"
136 0 0 unless open $prompt_fh, "+<", "/dev/tty"
167 0 47 if ($ttystate and $ttystate->echo)
171 0 0 if ($ttystate and $ttystate->line_input and $input_by_chars)
176 1 46 if ($print_prompt)
178 0 1 if (defined $start_len and defined $char_mask)
180 0 0 if ($n and $utf8)
187 0 1 unless $prompt_fh->print($state->{'prompt'} . $suffix) and $prompt_fh->flush
191 7 40 if ($input_by_chars) { }
193 30 30 if (defined $timeout)
195 26 4 if (Crypt::SecretBuffer::Exports::_wait_fh_readable($input_fh, $timeout)) { }
198 0 26 if $timeout < 0
207 0 56 if ($utf8 and $ttystate and $^O eq 'MSWin32') { }
209 0 0 unless (defined $ret)
212 0 0 if ($@ =~ /surrogate/)
214 0 0 $prompt_fh ? :
219 0 0 unless $ret
221 0 56 unless $ret = $self->append_read($input_fh, 1)
226 3 53 if ($self->index(qr/[\0-\x1F\x7F]/, $end_pos) == $end_pos) { }
28 25 elsif ($utf8) { }
230 3 0 if ($self->index(qr/[\r\n]/, $end_pos) == $end_pos) { }
0 0 elsif ($self->index(qr/[\b\x7F]/, $end_pos) == $end_pos) { }
237 0 0 if ($self->length > $start_len)
240 0 0 if (CORE::length $char_mask)
241 0 0 unless $prompt_fh->print("\b" x CORE::length($char_mask) . " " x CORE::length($char_mask) . "\b" x CORE::length($char_mask)) and $prompt_fh->flush
261 6 188 unless ($ch)
262 6 0 unless (defined $ch)
265 4 0 $span->starts_with(qr/[\xE0-\xEF]/) ? :
2 4 $span->starts_with(qr/[\xC0-\xDF]/) ? :
268 6 0 if $span->len < $ch_len
273 0 0 $prompt_fh ? :
279 0 188 if ($char_max and $count >= $char_max)
287 0 22 if (CORE::length $char_mask)
288 0 0 unless $prompt_fh->print($char_mask) and $prompt_fh->flush
292 0 22 if $char_count and $count == $char_count
295 0 25 if ($char_class and $self->index($char_class, $end_pos) == -1) { }
0 25 elsif ($char_max and $self->length - $start_len > $char_max) { }
305 0 25 if (CORE::length $char_mask)
306 0 0 unless $prompt_fh->print($char_mask) and $prompt_fh->flush
310 0 25 if $char_count and $self->length - $start_len == $char_count
317 0 40 if ($char_max and $self->length - $start_len > $char_max)
323 8 39 unless (defined $ret)
329 1 38 if defined $state->{'prompt'}
332 0 34 $char_count ? :
5 34 !$ret ? :
340 0 2 unless pipe my $r, my $w
349 0 1 unless open my $fh, "<", $path
351 0 1 unless ($chunksize)
358 0 2 unless defined $got
359 1 1 if $got == 0
364 0 1 unless close $fh
373 1 2 if (not $overwrite) { }
1 1 elsif ($overwrite eq 'rename') { }
374 1 0 if -e $path
376 0 0 unless open $fh, ">>", $path
377 0 0 if -s $fh > 0
384 1 0 CORE::length $dest_dir ? :
387 0 1 unless open $fh, ">", $path
392 0 2 unless defined $w
395 0 2 unless close $fh
396 1 1 if ($overwrite eq "rename")
397 0 1 unless rename $cur_path, $path