rinceWind has asked for the wisdom of the Perl Monks concerning the following question:

I'm looking for a code snippet or a module that can prompt the user for a password. Searching found this node. The following snippet, which I found here will do the trick in a very Unixy way:
system('/usr/bin/stty', '-echo'); chomp($password=<STDIN>); system('/usr/bin/stty', 'echo');
This meets my immediate requirements, but ideally I would like something that works on VMS and Win32 (MS-DOS and Cygwin) and still finds the 'terminal' even when stdin has been redirected.

Replies are listed 'Best First'.
Re: Portably prompting for passwords
by zejames (Hermit) on Jun 19, 2002 at 09:37 UTC
      Sounds like what I was looking for.

      Thx.

Re: Portably prompting for passwords
by greenFox (Vicar) on Jun 19, 2002 at 09:53 UTC