http://qs321.pair.com?node_id=134538


in reply to how to make a password dissapear?

I recently answered this question on the beginners-perl mailing list. I think you might find the reponse very helpful.


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 sends 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,
Ovid

Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.