Beefy Boxes and Bandwidth Generously Provided by pair Networks Frank
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Inputting a password w/o having it displayed on screen

by TrinityInfinity (Scribe)
on Mar 15, 2001 at 19:11 UTC ( [id://64763]=perlquestion: print w/replies, xml ) Need Help??

This is an archived low-energy page for bots and other anonmyous visitors. Please sign up if you are a human and want to interact.

TrinityInfinity has asked for the wisdom of the Perl Monks concerning the following question:

I want to make a perl script that will take in a password, but the screen remains blank while inputting, or displays asterisks, etc. Pretty much the same thing I see on password prompts for logging into pine or anything in windows. Can someone point me to an example? I'm sure there's one out there... I'm just not having any luck in finding one. Thanks!
  • Comment on Inputting a password w/o having it displayed on screen

Replies are listed 'Best First'.
Re: Inputting a password w/o having it displayed on screen
by Masem (Monsignor) on Mar 15, 2001 at 19:18 UTC
    Term::Readline and Term::Readline::Gnu are what you are looking for; they are standard STDIN prompt modules, but can be used to do no-echo typing as you want with passwords.
    Dr. Michael K. Neylon - mneylon-pm@masemware.com || "You've left the lens cap of your mind on again, Pinky" - The Brain
Re: Inputting a password w/o having it displayed on screen
by SparkeyG (Curate) on Mar 15, 2001 at 19:19 UTC
    Try this on for size. It was found by searching this website using the ever-present search option near the top, left hand corner of each page.
    --SparkeyG
Re: Inputting a password w/o having it displayed on screen
by sierrathedog04 (Hermit) on Mar 15, 2001 at 21:18 UTC
    If the password is submitted online then use HTML's built-in password field. When submitting to an Apache webserver then use CGI.pm's password_field function, which writes the tags for you. The CGI.pm documentation gives the following example written in the named parameter style:
    print $query->password_field(-name=>'secret', -value=>'starting value', -size=>50, -maxlength=>80);

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://64763]
help
Sections?
Information?
Find Nodes?
Leftovers?
    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.