[Date Prev][Date Next][Thread Prev][Thread Next] [Search] [Date Index] [Thread Index]

Re: [MacPerl] Password Dialog



At 16:51 -0400 98/08/05, Chris Nandor wrote:
>
> >Otherwise, is there a STDIN solution?
>

["Off topic", but educational]

Note that Chris' solution would work on Unix perl, modified slightly:

#!/usr/local/bin/perl -w
# Warning - Unix specific solution!

print "Enter your password: ";
`stty -echo`;
chomp($pass = <STDIN>);
print "\nYour password is $pass\n";
`stty echo`;
__END__

(remember to add the extra \n; the one the user types isn't echoed!)

The problem is that raw mode is _really_ raw. echo / -echo turn on/off
echoing of characters to the screen but don't otherwise fool with the
processing of those characters.

It would be cool if MacPerl supported `stty -echo` and `stty echo` as well
;-)
---
Vicki Brown, vlb@cfcl.com        |\      _,,,---,,_
Journeyman Sourceror      ZZZzz /,`.-'`'    -.  ;-;;,_
Scripts & Philtres             |,4-  ) )-,_. ,\ (  `'-'
http://www.cfcl.com/~vlb      '---''(_/--'  `-'\_)
P.O. Box 1269 San Bruno, CA  94066

***** Want to unsubscribe from this list?
***** Send mail with body "unsubscribe" to mac-perl-request@iis.ee.ethz.ch