Discussion:
allow user input?
(too old to reply)
Brad
2006-01-09 20:03:35 UTC
Permalink
Hi All!
I don't know a lot of syntax of Perl. But
requesting user input shouldn't be too difficult.

However, this example doesn't work:
print "Enter a number:";
$num="chomp(<STDIN>)";
print "You entered $num\n";

The promptuser();
function doesn't work either.

However, as I was digging through the perl examples
in sys:perl\scripts and found the readpasswd.pl file.
So I can get user input and my script works. However
when a user types the text it shows up as asterisks(****).

Here is the example code:
use passwd;
$prompt = "Enter your password : ";
$passwd = getpasswd($prompt);
print 'Password you have typed is ' . $passwd;
print "\r\n\;


so, this works for what I want. But i'm just curious if
there is a function that I can just type text and not
display asterisks. Or if anyone has a better way for perl
on NetWare to stop and request user input?

The big picture here is I have modified the UserQuotas.pl
perl script. Instead of putting all the variables on the
command line, I will have the perl script stop and
request the info. But it will read the current quota for
that user and display it, then ask what to change the
new quota to. It works now, but when I type in the new
quota it's asterisks.

Thanks
Brad B.
Guenter Knauf, DevNet SysOp 32
2006-01-09 21:22:35 UTC
Permalink
Hi Brad,
Post by Brad
Hi All!
I don't know a lot of syntax of Perl. But
requesting user input shouldn't be too difficult.
print "Enter a number:";
$num="chomp(<STDIN>)";
print "You entered $num\n";
well, if Ou code wrong then no wonder it doesnt work....
try this:

print "Enter a number:";
$num=<STDIN>;
chomp($num);
print "You entered $num\n";

Guenter.
Brad
2006-01-11 19:13:34 UTC
Permalink
Post by Guenter Knauf, DevNet SysOp 32
well, if Ou code wrong then no wonder it doesnt work....
print "Enter a number:";
$num=<STDIN>;
chomp($num);
print "You entered $num\n";
Guenter.
Hi Guenter,
Thanks very much for correcting me!

It's working great now.
I modified the userquotas.pl script someone wrote, I can
either pass the volume/username/quota in the command line
or if I don't do that the script will ask me for each.

Then, it shows me the current quota that is set and ask
if I want to change the quota or not, if not quit, if so
type the new quota, display the new quota, then quit.

Then someone here at work asked, can we put that on a web
page, so I went looking for your web site to turn on
cgi-bin. Which I had to use google cache to find your
.conf file. And then I had to turn on .htaccess to get
an authentication to the page. All is working very well,
thanks to your direction.

PS, when will the new site be up?

Brad
Guenter Knauf, DevNet SysOp 32
2006-01-11 20:25:26 UTC
Permalink
Hi Brad,
Post by Brad
PS, when will the new site be up?
since yesterday all is up again;
everything from www.gknw.com is now available at www.gknw.at
just still tons of links broken; this will take some longer;
so if you see a link going to gknw.com just replace to .at and you should
find it; other resources are f.e. my Apache index page (on all my domains):
http://www.gknw.de/development/apache
or my own forum:
http://www.gknw.de/phpbb

Guenter.

Loading...