rsriram has asked for the wisdom of the Perl Monks concerning the following question:
Hi, I am writing a Win32 script to accept a user name and password. When the user types the password, the text should not be displayed on the screen. I used Term::ReadKey and wrote a code as follows.
print "User name: "; chop ($name=<STDIN>); if ($name eq "") { die "Invalid user"; }else{ print "Password :"; my $pass = ReadKey(2); }
After entering the username, the cursor is not appearing in the screen and if I hit any key, the program terminates after reporting invalid password. Can anyone tell me how to hide the display of password when typing it on the screen?
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Suppressing display of text in the screen
by marto (Cardinal) on Aug 29, 2006 at 11:49 UTC | |
|
Re: Suppressing display of text in the screen
by cdarke (Prior) on Aug 29, 2006 at 12:39 UTC | |
|
Re: Suppressing display of text in the screen
by GrandFather (Saint) on Aug 29, 2006 at 19:09 UTC | |
|
Re: Suppressing display of text in the screen
by wojtyk (Friar) on Aug 29, 2006 at 16:15 UTC |