Branch Coverage

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


line true false branch
22 0 0 unless $_[0]
23 0 0 unless open my $OUT, '>/dev/tty'
86 0 0 $flags_alias{$_} || defined $_ ? :
89 0 0 if (ref $_ eq 'HASH') { }
0 0 elsif (ref $_ eq 'GLOB' or UNIVERSAL::isa($_, 'IO::Handle')) { }
0 0 elsif (/^-/) { }
93 0 0 unless -w $_
98 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)/-/) { }
99 0 0 unless defined $clearfirst
126 0 0 if @data < $i + 2 or not defined $data[$i + 1]
137 0 0 if defined $_ and /^-./
146 0 0 ref $_ eq 'Regexp' ? :
0 0 !defined($_) ? :
149 0 0 unless ref $_ eq 'HASH'
155 0 0 unless _smartmatch($input, $reqs{$_})
161 0 0 if (@prompt and exists $$flags{-'default'})
163 0 0 unless $prompt =~ /\[.*\]/
178 0 0 unless $OUT
180 0 0 if not @prompt and $flags{-'prompt'}
182 0 0 if ($flags{-'tty'} or $flags{-'argv'}) { }
183 0 0 unless open $IN, '
189 0 0 unless (&Scalar::Util::openhandle(*$ARGV))
191 0 0 unless open $ARGV
194 0 0 unless -t $IN
196 0 0 unless defined $flags{-'speed'}
200 0 0 if not defined $clearfirst and $flags{-'clearfirst'}
203 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'}) { }
207 0 0 if @ARGV
208 0 0 if -t $IN and not @prompt
232 0 0 if $defined and not $flags{-'line'}
236 0 0 if $success and $RECORD
237 0 0 if $flags{-'raw_input'}
248 0 0 if $val and $RECORD
249 0 0 if $raw
260 0 0 if $raw
277 0 0 unless grep {$_ eq $sym;} @EXPORT_OK
284 0 1 if (join($", @_) eq '-clearfirst')
289 0 0 if $RECORD
290 0 0 if ($_[$i] eq '-record')
292 0 0 unless open $RECORD, '>', '__PROMPT__'
297 0 1 if @_
302 0 1 if defined $input{$pkg}
305 0 1 if (my $datahandle = *{"${pkg}::DATA";}{'IO'}) { }
308 0 0 if ($data =~ s/(\A|\n) __PROMPT__ \s*? \n (.*)/$1/sx) { }
314 0 0 unless open "${pkg}::DATA", '<', \$data
326 0 0 ord $_ < $baseline ? :
0 0 ord $_ == 0 ? :
0 0 $_ eq "\n" ? :
0 0 isprint($_) ? :
339 0 0 if (ref $_ eq 'HASH') { }
0 0 elsif (not $speed) { }
340 0 0 if exists $$_{-'speed'}
341 0 0 if exists $$_{-'to'}
342 0 0 if exists $$_{-'echo'}
349 0 0 defined $echo ? :
362 0 0 if ($input =~ /\cD|\cZ/)
363 0 0 if ($input eq "\e")
369 0 0 unless (defined $line)
374 0 0 if pos $input{$caller} == length $input{$caller}
375 0 0 if ($input eq "\n") { }
377 0 0 unless (defined <$IN>)
383 0 0 unless $done
384 0 0 if (getc $IN eq "\n")
385 0 0 if $done
400 0 0 unless defined $nlstr
401 0 0 unless (-t $IN)
402 0 0 unless $onechar
414 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) { }
419 0 0 if (defined $input and length $input)
437 0 0 if ($next eq "\n") { }
438 0 0 if ($input eq "\n" and exists $$flags{-'default'})
443 0 0 defined $echo ? :
0 0 defined $echo && $$flags{-'menu'} ? :
448 0 0 $onechar ? :
453 0 0 defined $echo ? :
459 0 0 if ($onechar or not defined $next or $input =~ m[\Q$/\E$])
460 0 0 unless $$flags{-'line'}
461 0 0 if ($require and my $mesg = &$require($input)) { }
468 0 0 if defined $newlines
469 0 0 $onechar ? :
479 0 0 unless defined $yes
480 0 0 unless defined $no
481 0 0 $yesprompt ? :
0 0 $yesprompt && $noprompt ? :
486 0 0 if -t $IN
490 0 0 unless $$flags{-'line'}
491 0 0 if defined $response and $response =~ /$yes/
493 0 0 if not defined $response or $response =~ /$no/
495 0 0 if -t $IN
507 0 0 if -t $IN
512 0 0 if defined $response and not $$flags{-'line'}
513 0 0 if (-t $IN and defined $response)
514 0 0 if (not $response =~ /\A \s* $match \s* \Z/x) { }
0 0 elsif ($require and my $mesg = &$require($response)) { }
523 0 0 if print {$OUT;} "\n"
533 0 0 $datatype eq 'HASH' ? :
0 0 $datatype eq 'ARRAY' ? :
538 0 0 $datatype eq 'ARRAY' ? :
542 0 0 if $count > 26
543 0 0 if $count < 1
552 0 0 if (defined $$flags{-'default'} and not defined $default_key and $item eq $$flags{-'default'})
565 0 0 if -t $IN
571 0 0 if (-t $IN and defined $response)
572 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])) { }
576 0 0 if ($response ne $$flags{-'default'})
589 0 0 defined $response ? :
590 0 0 if (defined $response and ref($response) =~ /\A(?:HASH|ARRAY)\z/msx)
592 0 0 if (defined $response and $response eq "\e")
593 0 0 if -t $IN
608 0 0 $type eq 'HASH' ? :
0 0 $type eq 'ARRAY' ? :
0 0 $type eq 'Regexp' ? :
0 0 $type eq 'CODE' ? :
617 0 0 if $_[0]{'set_val'}
627 0 0 unless $_[0]{'handled'}