Cool, works like a breeze, thanks very much :-)) (Huge smile)

-----Original Message-----
From: $Bill Luebkert [mailto:[EMAIL PROTECTED]
Sent: Tuesday, November 25, 2003 3:21 PM
To: Kraaijer Ronald
Cc: perl-win32-users
Subject: Re: Asking for password


Kraaijer Ronald wrote:

> Works, but I would like to still echo a character representation "*", any
> ideas on that?

Try something like:

        binmode STDIN;
        print "Password: ";
        ReadMode ('cbreak');
        while (defined (my $ch = ReadKey ())) {

                last if $ch eq "\x0a" or $ch eq "\x0d";
                if ($ch eq "\x08") {    # backspace
                        print "\b \b" if $pwd;          # back up 1
                        chop $pwd;
                        next;
                }
                if ($ch eq "\x15") {    # ^U
                        print "\b \b" x length $pwd;    # back 1 for each
char
                        $pwd = '';
                        next;
                }
                $pwd .= $ch;
                print '*';
        }
        ReadMode ('restore');


-- 
  ,-/-  __      _  _         $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)

________________________________________________________________________________
Disclaimer - Winterthur Europe Assurances - Avenue des Arts/Kunstlaan 56 -  1000 
Brussels - Belgium.
This e-mail is intended solely for the above-mentioned recipient and it may contain 
confidential or privileged information. If you have
received it in error, please notify the sender immediately and delete the e-mail. You 
must not copy, distribute, disclose or take any
action in reliance on it. 
This e-mail message and any attached files have been scanned for the presence of 
computer viruses. However, you are advised that 
you open any attachments at your own risk. 



_______________________________________________
Perl-Win32-Users mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs

Reply via email to