Alex,
try something like this:
## assume %config contains Username,Password keys, in this instance,
empty vals
use Term::ReadKey;
my ($user, $pass) = '';
if ( $config{'Username'} eq '' )
{
print "Username: ";
$user=<STDIN>;
chomp($user);
$config{'Username'} = $user;
}
if ( $config{'Password'} eq '' )
{
if ($^O eq 'MSWin32') {
ReadMode 'noecho';
} else {
system("stty -echo");
}
print "${config{'Username'}}'s password: ";
$pass = <STDIN>;
chomp($pass);
$config{'Password'} = $pass;
if ($^O eq 'MSWin32') {
ReadMode 'normal';
} else {
system("stty echo");
}
}
That's what I've been using...
Matt Reinfeldt
Remedy System Administrator & Developer
U.S. Cellular
-----Original Message-----
From: Alexander Apprich [mailto:[EMAIL PROTECTED]]
Sent: Tuesday, June 26, 2001 10:07 AM
To: [EMAIL PROTECTED]; [EMAIL PROTECTED]
Subject: Hide input from STDIN
Hi all!
I hope someone can help me with this:
print "Please type in your username:";
$User = (<STDIN>);
chomp $User;
Now I need the same with the user's password. But I don't want
it visible on the screen. Something like * for every char or
nothing would be nice either.
Problem: I am a local Admin on a Win2K-Box and need to connect to
some shares from Linux-Boxes. The local Admin is not known in the
network, so need to connect to the shares as myself.
Thanks in advance for all your help, I really appriciate it.
Alex
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin
_______________________________________________
Perl-Win32-Admin mailing list
[EMAIL PROTECTED]
http://listserv.ActiveState.com/mailman/listinfo/perl-win32-admin