Hi Eric,
ericv wrote:
ok Bill,
I am talk about the function read_password which is part of the Term module.
It apparently works in all other platforms ( unix, etc...) but is know not to
work on Win32 ( and i confirm that!)
I am working on a command line script, and need to input a password from the console, and obviously
i would avoid to show it explicitly.
Any ideas ?
TermReadkey works on Win32. Not as well as on Linux/Unix, but it works.
Not pretty but it works too :-D
[EMAIL PROTECTED] scripts $ cat password.pl
#!/usr/bin/perl
use strict;
use warnings;
use Term::ReadKey;
my $name;
my $password;
print "Your name?: ";
$name = GetInput();
print "Your password: ";
$password = GetInput("passwd");
print "\n";
sub GetInput {
my $token;
$_ = shift;
ReadMode('noecho') if defined $_ && ( $_ eq "passwd" );
while ( not defined ( $token = ReadLine(0) ) ) {
# No key pressed yet
}
ReadMode('normal') if defined $_ && ( $_ eq "passwd" );
chomp $token;
return $token
}
Hth
Alex
Thanks
-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
Sent: Wed 5/25/2005 2:09 PM
To: ericv
Cc: perl-win32-users@listserv.ActiveState.com
Subject: Re: Perl on Win32: any possibility to emule "read_password"
ericv wrote:
> Hi folks,
>
> the question is very simple: the function "read_password" does not work on Win 32 platforms.
> I have been searching for a solution everywhere i knew about, without
success.
>
> how could I achieve my goal, that is exactly to input a password without curious people to see
> what is written ?
Guess what Eric, I have no idea what you're talking about.
What's read_password ? Part of some of your code, maybe a function
in a Perl module, some C code maybe ? Please be a little more explcit
since there are ways to accept input without echoing, we just need to
know what you're talking about - web page, commandline, GUI window ?
--
,-/- __ _ _ $Bill Luebkert Mailto:[EMAIL PROTECTED]
(_/ / ) // // DBE Collectibles Mailto:[EMAIL PROTECTED]
/ ) /--< o // // Castle of Medieval Myth & Magic
http://www.todbe.com/
-/-' /___/_<_</_</_ http://dbecoll.tripod.com/ (My Perl/Lakers stuff)
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
--
Alexander Apprich science + computing ag
IT-Services Hagellocher Weg 71-75
phone +49(0)7071 9457-291 D-72070 Tuebingen, Germany
fax +49(0)7071 9457-211 www.science-computing.de
s+c certificates via http://www.science-computing.de/cacert.crt
_______________________________________________
Perl-Win32-Users mailing list
Perl-Win32-Users@listserv.ActiveState.com
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs