Branch Coverage

blib/lib/IO/Prompt.pm
Criterion Covered Total %
branch 4 268 1.4


line true false branch
23 0 0 unless $_[0]
24 0 0 unless open my $OUT, '>/dev/tty'
87 0 0 $flags_alias{$_} || defined $_ ? :
90 0 0 if (ref $_ eq 'HASH') { }
0 0 elsif (ref $_ eq 'GLOB' or UNIVERSAL::isa($_, 'IO::Handle')) { }
0 0 elsif (/^-/) { }
94 0 0 unless -w $_
99 0 0 if (s/^-(f|clearfirst)/-/) { }
0 0 elsif (s/^-(yes|y)/-/i) { }
0 0 elsif (s/^-(?:nl|newline)/-/i) { }
0 0 elsif (s/^-escape|-x/-/i) { }
0 0 elsif (s/^-raw_?(?:input)?/-/i) { }
0 0 elsif (s/^-number|-num/-/i) { }
0 0 elsif (s/^-integer|-i/-/i) { }
0 0 elsif (s/^-(no|n)/-/i) { }
0 0 elsif (/^-($flag_with_arg)/) { }
0 0 elsif (s/^-($flag_no_arg)/-/) { }
100 0 0 unless defined $clearfirst
127 0 0 if @data < $i + 2 or not defined $data[$i + 1]
138 0 0 if defined $_ and /^-./
147 0 0 ref $_ eq 'Regexp' ? :
0 0 !defined($_) ? :
150 0 0 unless ref $_ eq 'HASH'
156 0 0 unless _smartmatch($input, $reqs{$_})
162 0 0 if (@prompt and exists $$flags{-'default'})
164 0 0 unless $prompt =~ /\[.*\]/
179 0 0 unless $OUT
181 0 0 if not @prompt and $flags{-'prompt'}
183 0 0 if ($flags{-'tty'} or $flags{-'argv'}) { }
184 0 0 unless open $IN, '
190 0 0 unless (&Scalar::Util::openhandle(*$ARGV))
192 0 0 unless open $ARGV
195 0 0 unless -t $IN
197 0 0 unless defined $flags{-'speed'}
201 0 0 if not defined $clearfirst and $flags{-'clearfirst'}
204 0 0 if (-t $IN and defined $input{$caller}) { }
0 0 elsif ($flags{-'argv'}) { }
0 0 elsif ($flags{-'yesno'}) { }
0 0 elsif ($flags{-'number'}) { }
0 0 elsif ($flags{-'menu'}) { }
208 0 0 if @ARGV
209 0 0 if -t $IN and not @prompt
233 0 0 if $defined and not $flags{-'line'}
237 0 0 if $success and $RECORD
238 0 0 if $flags{-'raw_input'}
249 0 0 if $val and $RECORD
250 0 0 if $raw
261 0 0 if $raw
278 0 0 unless grep {$_ eq $sym;} @EXPORT_OK
285 0 1 if (join($", @_) eq '-clearfirst')
290 0 0 if $RECORD
291 0 0 if ($_[$i] eq '-record')
293 0 0 unless open $RECORD, '>', '__PROMPT__'
298 0 1 if @_
303 0 1 if defined $input{$pkg}
306 0 1 if (my $datahandle = *{"${pkg}::DATA";}{'IO'}) { }
309 0 0 if ($data =~ s/(\A|\n) __PROMPT__ \s*? \n (.*)/$1/sx) { }
315 0 0 unless open "${pkg}::DATA", '<', \$data
327 0 0 ord $_ < $baseline ? :
0 0 ord $_ == 0 ? :
0 0 $_ eq "\n" ? :
0 0 _isprint($_) ? :
340 0 0 if (ref $_ eq 'HASH') { }
0 0 elsif (not $speed) { }
341 0 0 if exists $$_{-'speed'}
342 0 0 if exists $$_{-'to'}
343 0 0 if exists $$_{-'echo'}
350 0 0 defined $echo ? :
363 0 0 if ($input =~ /\cD|\cZ/)
364 0 0 if ($input eq "\e")
370 0 0 unless (defined $line)
375 0 0 if pos $input{$caller} == length $input{$caller}
376 0 0 if ($input eq "\n") { }
378 0 0 unless (defined <$IN>)
384 0 0 unless $done
385 0 0 if (getc $IN eq "\n")
386 0 0 if $done
401 0 0 unless defined $nlstr
402 0 0 unless (-t $IN)
403 0 0 unless $onechar
415 0 0 if ($next eq $cntl{'INTERRUPT'}) { }
0 0 elsif ($next eq $cntl{'ERASE'}) { }
0 0 elsif ($next eq $cntl{'EOF'}) { }
0 0 elsif ($$flags{-'escape'} and $next eq "\e") { }
0 0 elsif (not $next =~ /$cntl/ and defined $next) { }
420 0 0 if (defined $input and length $input)
438 0 0 if ($next eq "\n") { }
439 0 0 if ($input eq "\n" and exists $$flags{-'default'})
444 0 0 defined $echo ? :
0 0 defined $echo && $$flags{-'menu'} ? :
449 0 0 $onechar ? :
454 0 0 defined $echo ? :
460 0 0 if ($onechar or not defined $next or $input =~ m[\Q$/\E$])
461 0 0 unless $$flags{-'line'}
462 0 0 if ($require and my $mesg = &$require($input)) { }
469 0 0 if defined $newlines
470 0 0 $onechar ? :
480 0 0 unless defined $yes
481 0 0 unless defined $no
482 0 0 $yesprompt ? :
0 0 $yesprompt && $noprompt ? :
487 0 0 if -t $IN
491 0 0 unless $$flags{-'line'}
492 0 0 if defined $response and $response =~ /$yes/
494 0 0 if not defined $response or $response =~ /$no/
496 0 0 if -t $IN
508 0 0 if -t $IN
513 0 0 if defined $response and not $$flags{-'line'}
514 0 0 if (-t $IN and defined $response)
515 0 0 if (not $response =~ /\A \s* $match \s* \Z/x) { }
0 0 elsif ($require and my $mesg = &$require($response)) { }
524 0 0 if print {$OUT;} "\n"
534 0 0 $datatype eq 'HASH' ? :
0 0 $datatype eq 'ARRAY' ? :
539 0 0 $datatype eq 'ARRAY' ? :
543 0 0 if $count > 26
544 0 0 if $count < 1
553 0 0 if (defined $$flags{-'default'} and not defined $default_key and $item eq $$flags{-'default'})
566 0 0 if -t $IN
572 0 0 if (-t $IN and defined $response)
573 0 0 if (length $response == 1 and $response eq "\e") { }
0 0 elsif (length $response > 1 or ($response lt 'a' or $response gt $max_char)) { }
0 0 elsif ($require and my $mesg = &$require($data[ord($response) - 97])) { }
577 0 0 if ($response ne $$flags{-'default'})
590 0 0 defined $response ? :
591 0 0 if (defined $response and ref($response) =~ /\A(?:HASH|ARRAY)\z/msx)
593 0 0 if (defined $response and $response eq "\e")
594 0 0 if -t $IN
609 0 0 $type eq 'HASH' ? :
0 0 $type eq 'ARRAY' ? :
0 0 $type eq 'Regexp' ? :
0 0 $type eq 'CODE' ? :
618 0 0 if $_[0]{'set_val'}
628 0 0 unless $_[0]{'handled'}