Prompt for user input using IO::Prompter
Simple input and input passwords
In the first example we ask the user for a simple input and then we ask for a password. The special thing in the password is that we don't want the system to echo back the characters as we type them so other people won't see them.
use 5.010; use strict; use warnings; use IO::Prompter; my $user = prompt 'Username:'; my $passwd = prompt 'Password:', -echo=>'*'; say $user; say $passwd;
In the second example we see how to ask the user to select an item from a list of items:
use 5.010; use strict; use warnings; use IO::Prompter; my $selection = prompt 'Choose wisely...', -menu => [qw(wealth health wisdom)], '>'; say $selection;
Published on 2019-04-27