Darn it, beat me to the punch
I just saw his question and was reading the chapter when I saw your post...


-----Original Message-----
From: Brett W. McCoy [mailto:[EMAIL PROTECTED]]
Sent: Friday, May 25, 2001 3:04 PM
To: [EMAIL PROTECTED]
Cc: [EMAIL PROTECTED]
Subject: Re: hiding logins at prompt


On Fri, 25 May 2001 [EMAIL PROTECTED] wrote:

> I've got a Perl script that logs into one of our applications as Admin.  I
> didn't want to hard code in the password, so I'm prompting for it.  I was
> looking for a way to hide the input, just like when you log into a Unix or
NT
> box.  I was hoping to either have the actual input chars replaced with
'*'s or
> just blanks or something along those lines.

You should use the Term::ReadKey module and set it to nocecho:

use Term::ReadKey;

ReadMode('noecho');
my $passwd = ReadLine(0);

Recipe 15.10 in the Perl Cookbook has a full example of this.  If you
don't have the Perl Cookbook, you need to get to a bookstore and get a
copy.

-- Brett

Brett W. McCoy
Software Engineer
Broadsoft, Inc.
240-364-5225
[EMAIL PROTECTED]

Reply via email to