| Author |
How do I ask the user for a password?
|
|
| Bernd Nies 2005-05-27, 8:56 am |
| The perl FAQ says:
use Term::ReadKey;
ReadMode('noecho');
$password = ReadLine(0);
Is this also possible without installing an additional module?
This module is not on a Solaris 8 Perl 5.005_03 standard perl
installation and we can't/don't want install additional modules and the
hundred dependencies.
Thanks in advance.
Regards,
Bernd
| |
| optional 2005-05-27, 8:57 pm |
| Try this;
chomp(my $ans = `stty -noecho; read ans; echo \$ans`);
print "ans = $ans\n";
Siva
| |
| Eric Schwartz 2005-05-27, 8:57 pm |
| "Bernd Nies" <bnies@bluewin.ch> writes:
> The perl FAQ says:
>
> use Term::ReadKey;
>
> Is this also possible without installing an additional module?
>
> This module is not on a Solaris 8 Perl 5.005_03 standard perl
> installation and we can't/don't want install additional modules and the
> hundred dependencies.
A) That perl is ancient beyond belief. There are innumerable bugs and
security holes. Please consider moving to a perl released in the
current millenium.
B) What's wrong with modules? We hear this now and again, but I
honestly don't understand why you'd want to reinvent the wheel,
usually poorly, rather than use well-tested and widely-used code
that already solves your problem.
That's not a comment on your coding skill, BTW-- it's just that
anyone's first stab at solving a problem is likely to be inferior
to code which has been around and bugfixed for quite some time.
C) Term::ReadKey doesn't depend on anything outside the core Perl
modules. If you read the source, you'll see:
require Exporter;
require AutoLoader;
require DynaLoader;
use Carp;
all of which are distributed with Perl. It's possible Carp might
not be with such an ancient perl, but I believe it was. I know for
a fact it's included with all modern (i.e., in the last, say, 5
years) versions of perl.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
| |
| Bernd Nies 2005-05-27, 8:57 pm |
| Thanks for your answer.
Just to explain my motives: That perl version is on some hundred
Solaris 8 hosts of a customer. I can't expect him to install a whole
new perl distribution or modules for just one small script.
Regards,
Bernd
| |
| Charles DeRykus 2005-05-27, 8:57 pm |
| In article <1117188772.239084.85420@o13g2000cwo.googlegroups.com>,
Bernd Nies <bnies@bluewin.ch> wrote:
>The perl FAQ says:
>
> use Term::ReadKey;
>
> ReadMode('noecho');
> $password = ReadLine(0);
>
>Is this also possible without installing an additional module?
>
>This module is not on a Solaris 8 Perl 5.005_03 standard perl
>installation and we can't/don't want install additional modules and the
>hundred dependencies.
>
system("stty -echo") == 0 or die "can't turn off echo: $?";
....
system("stty echo") == 0 or die "can't turn on echo: $?";
will work on some Unix-based hosts
hth,
--
Charles DeRykus
| |
| xhoster@gmail.com 2005-05-27, 8:57 pm |
| "Bernd Nies" <bnies@bluewin.ch> wrote:
> The perl FAQ says:
>
> use Term::ReadKey;
>
> ReadMode('noecho');
> $password = ReadLine(0);
>
> Is this also possible without installing an additional module?
print "May I have your password please? (If someone is watching over
your shoulder, shoo them away).\n";
my $password=<STDIN>; chomp $password;
print "\n" foreach 1..100;
> This module is not on a Solaris 8 Perl 5.005_03 standard perl
> installation and we can't/don't want install additional modules and the
> hundred dependencies.
Xho
--
-------------------- http://NewsReader.Com/ --------------------
Usenet Newsgroup Service $9.95/Month 30GB
| |
| Eric Schwartz 2005-05-27, 8:57 pm |
| "Bernd Nies" <bnies@bluewin.ch> writes:
> Thanks for your answer.
Whose answer? Please quote some context when you reply to someone, or
else we have no idea what you're talking about or who you're talking
to.
-=Eric
--
Come to think of it, there are already a million monkeys on a million
typewriters, and Usenet is NOTHING like Shakespeare.
-- Blair Houghton.
| |
| Bernd Nies 2005-05-30, 8:57 am |
|
Eric Schwartz schrieb:
> "Bernd Nies" <bnies@bluewin.ch> writes:
>
> Whose answer? Please quote some context when you reply to someone, or
> else we have no idea what you're talking about or who you're talking
> to.
I was replying to you and your posting about 'TERM::ReadKey'.
GoogleGroups does not quote the original text by default.
Regards,
Bernd
| |
| Bernd Nies 2005-05-30, 3:57 pm |
|
optional schrieb:
> Try this;
>
> chomp(my $ans = `stty -noecho; read ans; echo \$ans`);
>
> print "ans = $ans\n";
>
> Siva
Thanks for that hint. The following code works fine for me:
my $phrase;
print "Enter passphrase:\n";
system('stty', '-echo');
$phrase = <STDIN>;
system('stty', 'echo');
chomp($phrase);
Regards,
Bernd
| |
| Tad McClellan 2005-05-30, 3:57 pm |
| Bernd Nies <bnies@bluewin.ch> wrote:
> Eric Schwartz schrieb:
[color=darkred]
> GoogleGroups does not quote the original text by default.
If the default is socially unacceptable, then you should perhaps
consider not allowing it to default (by being explicit).
(and maybe complaining to the designers for choosing a default
that will very likely hurt their users experience.)
--
Tad McClellan SGML consulting
tadmc@augustmail.com Perl programming
Fort Worth, Texas
| |
| Bernd Nies 2005-05-30, 3:57 pm |
| Hi,
> If the default is socially unacceptable, then you should perhaps
> consider not allowing it to default (by being explicit).
> (and maybe complaining to the designers for choosing a default
> that will very likely hurt their users experience.)
Whatever ... some complain that one doesn't quote, some complain that
one quotes. Seems that this is the biggest worry for some people. Hey,
there is a life OUTSIDE the computer! ;-)
Bye
Bernd
| |
| A. Sinan Unur 2005-05-30, 3:57 pm |
| "Bernd Nies" <bnies@bluewin.ch> wrote in news:1117472158.592046.168650
@g14g2000cwa.googlegroups.com:
[ You snipped the attribution for the following. Don't do that. ]
Tad McClellan <tadmc@augustmail.com> wrote in
news:slrnd9mccp.j1c.tadmc@magna.augustmail.com:
>
> Whatever ... some complain that one doesn't quote, some complain that
> one quotes.
That is why you should quote an *appropriate* amount and quote
accurately.
> Seems that this is the biggest worry for some people.
It ought to be your biggest worry since you are the one whose asking for
assistance.
> Hey, there is a life OUTSIDE the computer! ;-)
Hmmm ... are you suggesting that there are little people living in my
computer? Look, it's been 25 years since we were impressed by Tron. It's
time to move on.
Sinan
--
A. Sinan Unur <1usa@llenroc.ude.invalid>
(reverse each component and remove .invalid for email address)
comp.lang.perl.misc guidelines on the WWW:
http://mail.augustmail.com/~tadmc/c...guidelines.html
| |
| Brian McCauley 2005-05-30, 3:57 pm |
| Bernd Nies wrote:
> [ Attribution to Tad missing ]
>
>
> Whatever ... some complain that one doesn't quote, some complain that
> one quotes.
Please specify the URL of a Usenet post on google groups where anyone
(other than an obvious kook) ever complains that someone has quoted.
Note that I'm looking for a complaint that someone has quoted at all, as
opposed to complaint that the quote was excessive or out of sequence.
|
|
|
|