This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
devtools.pl: Re-prompt if user typed wrong
authorKarl Williamson <khw@cpan.org>
Mon, 8 Jul 2019 20:36:19 +0000 (14:36 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:30 +0000 (16:39 -0600)
Previously it just waited for the user to type the right thing without
prompting that it was doing so.

It also prints a BEL character to notify that attention is needed.

(cherry picked from commit 4b79a8599508f7ad03e4f6e8b62062f5ba989969)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/devel/devtools.pl

index 465c3cc..a60c6f3 100644 (file)
@@ -93,8 +93,10 @@ sub ask($)
   my $q = shift;
   my $a;
   local $| = 1;
-  print "\n$q [y/n] ";
-  do { $a = <>; } while ($a !~ /^\s*([yn])\s*$/i);
+  do {
+    print "\a\n$q [y/n] ";
+    $a = <>; }
+  while ($a !~ /^\s*([yn])\s*$/i);
   return lc $1 eq 'y';
 }