Front page | perl.beginners |
Postings from December 2001
Re: STDIN
Thread Previous
From:
Curtis Poe
Date:
December 20, 2001 08:34
Subject:
Re: STDIN
Message ID:
20011220163439.49494.qmail@web9103.mail.yahoo.com
--- walter valenti <waltervalenti@yahoo.it> wrote:
> Hi,
> someone knows, how insert text gron STDIN, without see this on the
> shell??
>
> For example for insert a password..
Walter,
I *think* what you are asking is "How do I get a password from STDIN without it showing up on the
screen?"
use Term::ReadKey;
ReadMode('noecho');
$password = ReadLine(0);
I've never used that before but some may be curious how I found it. Here's the trick:
perldoc perltoc > perltoc.txt
That pipes the perltoc (Perl Table of Contents) to a text file. I sometimes scan through this
file to pick up new tricks. When I see something that interests me (such as "password"), I scan
through the relevant entries. In this case, I saw the following entries:
[snip]
How do I clear the screen?
How do I get the screen size?
How do I ask the user for a password?
How do I read and write the serial port?
[snip]
The one about asking a user for a password looked useful, so I typed in:
perldoc -q "How do I ask the user for a password?"
That actually gave a lot more information than what I sent you, so you should give it a try :)
The '-q' options stands for "FAQ keyword", but it can just as easily stand for 'question'.
Cheers,
Curtis "Ovid" Poe
=====
"Ovid" on http://www.perlmonks.org/
Someone asked me how to count to 10 in Perl:
push@A,$_ for reverse q.e...q.n.;for(@A){$_=unpack(q|c|,$_);@a=split//;
shift@a;shift@a if $a[$[]eq$[;$_=join q||,@a};print $_,$/for reverse @A
__________________________________________________
Do You Yahoo!?
Check out Yahoo! Shopping and Yahoo! Auctions for all of
your unique holiday gifts! Buy at http://shopping.yahoo.com
or bid at http://auctions.yahoo.com
Thread Previous