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

[Fun With Perl] Invisible password (MacPerl)




     # MacPerl "puzzle" code
     # Note that this one is MacPerl specific.  `stty raw` is implemented
     # and emulated under MacPerl, but the result is a little different
     # from Unix

	Date: Wed, 5 Aug 1998 16:51:12 -0400
	To: MAC-PERL@iis.ee.ethz.ch

	# >Is there an easy way to have a dialog not show the characters
	# >entered?
	# >... is there a STDIN solution?

	# Yes.  This should work, I think:

	#!perl -w
	print "Enter your password: ";
	`stty raw`;
	chomp($pass = <STDIN>);
	print "Your password is $pass\n";
	`stty sane`;
	__END__

	# But in actuality, it does not work for me.  Hrm.  I get:

	Enter your password: # Use of uninitialized value.
	File 'Untitled #4'; Line 4
	# Use of uninitialized value.
	File 'Untitled #4'; Line 5
	Your password is


-- --
        |\      _,,,---,,_       Vicki Brown <vlb@cfcl.com>
  ZZZzz /,`.-'`'    -.  ;-;;,_   Journeyman Sourceror: Scripts & Philtres
       |,4-  ) )-,_. ,\ (  `'-'  P.O. Box 1269  San Bruno  CA  94066
      '---''(_/--'  `-'\_) http://www.cfcl.com/~vlb  http://www.macperl.org

==== Want to unsubscribe from this list? (Don't you love us anymore?)
==== Well, if you insist... Send mail with body "unsubscribe" to
==== fwp-request@technofile.org

</x-flowed>