| 1 | #!/usr/local/bin/perl -w | ||
| 2 | # | ||
| 3 | # A demo of Term::InKey functions | ||
| 4 | # | ||
| 5 | # Copyright (c) 2001, 2002, 2003, 2004 RAZ Information Systems Ltd. | ||
| 6 | # http://www.raz.co.il/ | ||
| 7 | |||
| 8 | # This program is distributed under the same terms as Perl itself, see the | ||
| 9 | # Artistic License on Perl's home page. | ||
| 10 | # | ||
| 11 | use strict; | ||
| 12 | use lib qw(.); | ||
| 13 | use Term::InKey; | ||
| 14 | |||
| 15 | my ($x,$bullet); | ||
| 16 | |||
| 17 | $|=1; | ||
| 18 | |||
| 19 | &Clear; | ||
| 20 | |||
| 21 | print "\nThis is a demo program for Term::InKey Ver $Term::InKey::VERSION\n"; | ||
| 22 | print "Press any key to clear the screen: "; | ||
| 23 | $x = &ReadKey; | ||
| 24 | &Clear; | ||
| 25 | |||
| 26 | print "You pressed [$x]\n\n"; | ||
| 27 | print "Enter bullet for passowrd input [*]:"; | ||
| 28 | $bullet = &ReadKey; | ||
| 29 | $bullet .= &ReadKey if $bullet eq '-'; | ||
| 30 | $bullet = '*' if $bullet =~/\s/; | ||
| 31 | print "\n"; | ||
| 32 | print "This is a demo of ReadPassword, type few letters then type [enter]: "; | ||
| 33 | $x = &ReadPassword($bullet); | ||
| 34 | print "\nPassword you typed is [$x]\n"; | ||
| 35 | print "\nThis ends a demo program for Term::InKey Ver $Term::InKey::VERSION\n"; | ||
| 36 | |||
| 37 | 1; |