Created
August 25, 2016 11:10
-
-
Save tokuhirom/4b412e95ffd8dcd47792aeedf4df5e89 to your computer and use it in GitHub Desktop.
noecho prompting with IO::Prompt::Simple
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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