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

Re: [MacPerl] Password TextEntry



At 09:46 -0800 10/28/98, Douglas A. Spore wrote:
> I've been through the MacPerl's accompaning documentation and through
> "MacPerl Power and Ease" and can not find how to create a password text
> entry box where what is typed is not output back to the screen. Can
> Mac::Answer or tool box calls be made to do this? If so how? Any help
>would
> be appricated.

If we do another edition of the book I'll have to make this more clear!

At 14:56 -0700 98/08/05, Vicki Brown wrote:
> You need to get tricky to catch the characters one at a time, and
> process them appropriately.  Presuming you want the user to be able to
> press return and have thet enter the password, try:
>
> #!perl -w
> print "Enter your password: ";
> `stty raw`;
> while (1) {
>    $char = getc() while (!defined($char));
>    if ($char =~ /\n/) {
>         print $char;
>         last;
>    }
>    $pass .= $char;
>    undef $char;
> }
> `stty sane`;
> print "Your password is $pass\n";
> __END__
>
> When run, this produces:
>    Enter your password:
>
>    Your password is foobonnet
>
> (yeah, that's what I typed :-)


Alan Fry <ajf@afco.demon.co.uk> wrote a password.pm module that puts up a
dialog with bullets and all that nice Mac interface stuff; I won't post it
here (Alan may well have a newer version of that code and the list members
frown on large attachments...).
---
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