diff options
author | Niko Tyni <ntyni@debian.org> | 2016-05-01 20:06:37 +0300 |
---|---|---|
committer | Aaron Crane <arc@cpan.org> | 2016-05-16 13:29:46 +0100 |
commit | 9cea1b144d6a5c138a4576a9d70366d1949a51db (patch) | |
tree | 3418364ee380fc57db85ce55a750859c12775bb7 /utils | |
parent | fdfa33076f4f175751eccfb62ebb0c926a6307b0 (diff) | |
download | perl-9cea1b144d6a5c138a4576a9d70366d1949a51db.tar.gz |
perlbug: quit main loop on empty answer / eof in test mode
This makes it possible to drive perlbug noninteractively
without having it go to an infinite loop on end of file.
The change has no effect in non-test mode, where the default answer is
the empty string.
This is groundworks for perlbug unit tests.
Diffstat (limited to 'utils')
-rw-r--r-- | utils/perlbug.PL | 4 |
1 files changed, 3 insertions, 1 deletions
diff --git a/utils/perlbug.PL b/utils/perlbug.PL index caac732c73..9a5048f646 100644 --- a/utils/perlbug.PL +++ b/utils/perlbug.PL @@ -828,7 +828,8 @@ a few options. You can: EOF retry: print $menu; - my $action = _prompt('', "Action (Send/Display/Edit/Subject/Save to File)");; + my $action = _prompt('', "Action (Send/Display/Edit/Subject/Save to File)", + $opt{t} ? 'q' : ''); print "\n"; if ($action =~ /^(f|sa)/i) { # <F>ile/<Sa>ve if ( SaveMessage() ) { exit } @@ -1014,6 +1015,7 @@ sub _prompt { } print $prompt. ($default ? " [$default]" :''). ": "; my $result = scalar(<>); + return $default if !defined $result; # got eof chomp($result); $result =~ s/^\s*(.*?)\s*$/$1/s; if ($default && $result eq '') { |