Skip to content

Instantly share code, notes, and snippets.

@tokuhirom
Created August 25, 2016 11:10
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tokuhirom/4b412e95ffd8dcd47792aeedf4df5e89 to your computer and use it in GitHub Desktop.
Save tokuhirom/4b412e95ffd8dcd47792aeedf4df5e89 to your computer and use it in GitHub Desktop.
noecho prompting with IO::Prompt::Simple
use strict;
use Term::ReadKey;
use IO::Prompt::Simple;
use Scope::Guard qw/guard/;
my $guard = guard { Term::ReadKey::ReadMode(0) }; # restore
Term::ReadKey::ReadMode(4); # no echo
my $answer = prompt 'some question...';
print "\n";
print "answer: $answer\n";
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment