How to hide password

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • ronenbenchamo
    New Member
    • May 2007
    • 4

    How to hide password

    Hi All,
    I would like to get the passwordf from the user,
    I need to hide the password , replace it with '*' or not type user input,
    I don't want to use a package such as 'ReadKey' or any other
    How can I get the password and hide it?

    Thanks,
    Ronen
  • miller
    Recognized Expert Top Contributor
    • Oct 2006
    • 1086

    #2
    Hello Ronen,

    Look into the following cpan module:
    cpan Term::InKey

    Even if you don't want to use a package, you can still download the module and look at it's source to determine a way that you could code it all yourself.

    - Miller

    Comment

    • lonewlf
      New Member
      • May 2007
      • 1

      #3
      system('stty','-echo');
      chop($password= <STDIN>);
      system('stty',' echo');

      Comment

      • ketanm
        New Member
        • Aug 2010
        • 8

        #4
        hide password

        Hi all,
        I also want to hide password.i tried below solution in winxp but i got the error "'stty' is not recognized as an internal or external command,operabl e program or batch file.".

        how could i avoid this error?

        Thanks.

        Comment

        • ashtavatar
          New Member
          • Jan 2013
          • 1

          #5
          hi ketanm,

          Maybe more than a bit too late a reply for you, but you can use the Term::ReadKey module for this. Here is how:

          use strict;
          use warnings;
          use Term::ReadKey;

          ReadMode = 'noecho';
          my $password = <>;

          Comment

          Working...