Ned Cunningham wrote:
> Funny you just caught me working on something similar, and I have modified
> this code for my purposes. This should lead you in the right direction!
> Snip
>
> #!/usr/bin/perl
> use Win32::Console;
>
> $StdIn = new Win32::Console(STD_INPUT_HANDLE);
> my $Password = "";
> $StdIn->Mode(ENABLE_PROCESSED_INPUT);
> print "Enter Password: ";
> while (my $Data = $StdIn->InputChar(1)) {
> if("\r" eq $Data ) {
> last;
> } elsif ("\ch" eq $Data ) {
> if( "" ne chop( $Password )) {
> print "\ch \ch";
> }
> next;
> }
> $Password .=$Data;
> print "*";
> }
> print "\n $Password\n";
> <STDIN>
> #note take out this print so it doesn't display to the user;)
>
> Ned Cunningham
Took a bit of adjustment, but I got it to work on Win2K by setting the autoflush
global to true:
Greetings! E:\d_drive\perlStuff>perl -w
#!/usr/bin/perl
use Win32::Console;
$StdIn = new Win32::Console(STD_INPUT_HANDLE);
my $Password = "";
$StdIn->Mode(ENABLE_PROCESSED_INPUT);
local $| = 1; #without this, it didn't ever quite work.
print "Enter Password: ";
[snip--as in the above]
<STDIN>
^Z
Enter Password: *************
What the h*** [Asterisks added here for polite company]
--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]