469,306 Members | 1,896 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,306 developers. It's quick & easy.

Prompting for Passwords - obscuring input

hi
we are working on a program which has to read password from user
for security each character in the password must be echoed as *

1 print "enter passwd\n";
2 system('stty','-echo');
3 chop($passwd=<stdin>);
4 system('stty','echo');
5 open(myfile,'>>./c');
6 print myfile "$passwd\n";
7 close (myfile);

this is the code for hiding password completely
could u please help us with *
thanks inadvance
Jul 25 '07 #1
8 4851
miller
1,089 Expert 1GB
cpan IO::Prompt

Expand|Select|Wrap|Line Numbers
  1. use IO::Prompt;
  2.  
  3. my $passwd = prompt -echo => '*';
  4.  
- Miller
Jul 25 '07 #2
Can't locate IO/Prompt.pm in @INC (@INC contains:..................
thats the error its givin is it the prob of the perl compiler
anything tat could b done to resolve it
we r working on unix platform
Jul 25 '07 #3
numberwhun
3,503 Expert Mod 2GB
Yes, you are going to have to install the module IO::Prompt. That is the error you receive when the module you are trying to use is not installed.

ie: perl -MCPAN -e 'install IO::Prompt'

Regards,

Jeff
Jul 25 '07 #4
prn
254 Expert 100+
Can't locate IO/Prompt.pm in @INC (@INC contains:..................
thats the error its givin is it the prob of the perl compiler
anything tat could b done to resolve it
we r working on unix platform
That's because IO::Prompt is a CPAN module. It is not part of the standard Perl distro. That's why miller gave you a link. You have to install it separately.

The easiest way to install it is (preferably as root):

Expand|Select|Wrap|Line Numbers
  1. # perl -MCPAN -e shell
  2. cpan> install IO::Prompt
  3. ...
  4. cpan> quit
Assuming you have not used the CPAN module before, you will probably have to configure it. I just checked this on a Linux box where I had not used the CPAN module previously and almost all the questions in the configuration prompts were fairly obvious. It did prompt for the location of ncftpget, which I did not have installed, so I downloaded and installed it. I'm not sure that I had to, but it seemed like a good idea.

Once IO::Prompt is installed, miller's example code will work just fine.

HTH,
Paul
Jul 25 '07 #5
numberwhun
3,503 Expert Mod 2GB
That's because IO::Prompt is a CPAN module. It is not part of the standard Perl distro. That's why miller gave you a link. You have to install it separately.

The easiest way to install it is (preferably as root):

Expand|Select|Wrap|Line Numbers
  1. # perl -MCPAN -e shell
  2. cpan> install IO::Prompt
  3. ...
  4. cpan> quit
Assuming you have not used the CPAN module before, you will probably have to configure it. I just checked this on a Linux box where I had not used the CPAN module previously and almost all the questions in the configuration prompts were fairly obvious. It did prompt for the location of ncftpget, which I did not have installed, so I downloaded and installed it. I'm not sure that I had to, but it seemed like a good idea.

Once IO::Prompt is installed, miller's example code will work just fine.

HTH,
Paul
Sure, I see how you are... just step ALL over me. :-)

Jeff
Jul 25 '07 #6
miller
1,089 Expert 1GB
Some notes about IO::Prompt:
  • It is platform dependent on unix based systems as it has hardcoded access to /dev/tty
  • It's test suite is minimal, so it will install successfully under ActivePerl but will not work. I have written to the module maintainer about this issue. However, it does have a large set of examples included as part of its distribution.
  • It was suggested by the book "Perl Best Practices"; Chapter 10: I/O; Power Prompting.
- Miller
Jul 25 '07 #7
prn
254 Expert 100+
Sure, I see how you are... just step ALL over me. :-)

Jeff
Sorry, Jeff. I was composing mine when you posted. If I had seen yours first, I would have decided the question was already answered and left it alone. I'm just kind of compulsive (some people might have a different name for it ;-) ) sometimes.

Paul
Jul 26 '07 #8
numberwhun
3,503 Expert Mod 2GB
No worries! I was just busin' on ya. I chalked it up to re-enforcement of what I said. :-)

Regards,

Jeff
Jul 26 '07 #9

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

2 posts views Thread by Fred Emmott | last post: by
12 posts views Thread by Andrew DeFaria | last post: by
1 post views Thread by Paradigm | last post: by
10 posts views Thread by Dino M. Buljubasic | last post: by
19 posts views Thread by Cord-Heinrich Pahlmann | last post: by
3 posts views Thread by =?Utf-8?B?QmlsbHkgWmhhbmc=?= | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
reply views Thread by harlem98 | last post: by
1 post views Thread by Geralt96 | last post: by
reply views Thread by harlem98 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.