[17866] in Perl-Users-Digest
Perl-Users Digest, Issue: 26 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Tue Jan 9 18:05:38 2001
Date: Tue, 9 Jan 2001 15:05:13 -0800 (PST)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <979081512-v10-i26@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Tue, 9 Jan 2001 Volume: 10 Number: 26
Today's topics:
Re: ASCII to integer conversion <uri@sysarch.com>
Re: ASCII to integer conversion <uri@sysarch.com>
Re: ASCII to integer conversion (Greg Bacon)
Re: ASCII to integer conversion <joe+usenet@sunstarsys.com>
Re: ASCII to integer conversion (Martien Verbruggen)
Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
Re: ASCII to integer conversion <cliff@*MYLASTNAMEHERE*.nl>
Re: CGI vs Javascript dropdowns <eric.kort@vai.org>
drop in replacement for rlogind? mgrober@my-deja.com
Re: Fork lots of children <bart.lateur@skynet.be>
Re: How to humor a bad habit...? <timallen449@my-deja.com>
How to process an & <ja@nee.snee>
Re: How to process an & <joe+usenet@sunstarsys.com>
Re: Is $? set when using backticks to issue a system co (Brandon Metcalf)
Re: Jobs: Senior Software Engineer (David H. Adler)
Mysterious Perl problem jos_hunter_9@my-deja.com
Negating an RE within Perl <eblitzkrieg@hotmail.com>
Re: perl / CGI backend to change a user's unix password <ssomneb@my-deja.com>
Re: perl socket programming questions <wieland@netvertising.ch>
Standard Perl docs (Paul Delahunta)
Re: Stopping users from exploiting Perl 'interpreter' o (Jerome O'Neil)
Re: String length <monty@primenet.com>
Re: String length woodywit@my-deja.com
Taking control <flamer@primenet.com>
Re: Taking control <greg2@surfaid.org>
Re: trying to count words - not working (Martien Verbruggen)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Tue, 09 Jan 2001 19:21:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ASCII to integer conversion
Message-Id: <x7lmsk5y62.fsf@home.sysarch.com>
>>>>> "CP" == Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> writes:
CP> Rafael Garcia-Suarez wrote:
>>
>> > For instance, suppose we have a string that contains an important value
>> > we need for some other stuff. The only thing we know and can be certain
>> > of, is that this value can be found directly *after* a fixed delimiter
>> > (in this case a ","). Now everything directly following this number can
>> > be literally anything, except numbers:
>> >
>> > $a_string = "Random string with a value from somewhere,1234m/s";
>> > $a_number = substr( $a_string, index( $a_string, "," ) );
>> >
>> > Now we need to pass this number to another program:
>> >
>> > `a_program $a_string`;
>>
>> You should probably worry for security here (as each time a shell is
>> spawned).
>>
>> > See the problem? Now this of course can be easily fixed, the easiest
>> > (afaik) being by just adding the line (which also would be the answer to
>> > his question):
>> >
>> > $a_number += 0;
>>
>> The easiest fix is to do nothing, because there is no difference between
>> strings and numbers in Perl, and it is _very_ important to understand
CP> And that's exactly the problem. If you do nothing, Perl interprets it as
CP> a string an will send "1234m/s" to the program you are shelling. Perhaps
CP> in this case it's not a problem and the shelled program will simply
CP> generate an error message of some sorts. But what if the string
CP> contained something like "1234 -whatever" or anything else that the
CP> shelled program would consider a command-line parameter?
then your program has a BUG in it. you didn't extract the number, you
extracted a string which starts with a number. it is YOUR fault, not
perl's. learn perl and stop thinking in c. scalars hold numbers or
strings and there is no need to explicitly convert them. it is on your
(the programmer's) head to make sure the data is meaningful in the
proper contxt.
sheesh!
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 09 Jan 2001 19:30:41 GMT
From: Uri Guttman <uri@sysarch.com>
Subject: Re: ASCII to integer conversion
Message-Id: <x7itno5xr2.fsf@home.sysarch.com>
>>>>> "CP" == Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> writes:
>> > $a_string = "Random string with a value from somewhere,1234m/s";
>> > $a_number = substr( $a_string, index( $a_string, "," ) );
>> >
>> > $a_number += 0;
CP> Actually, it works perfectly. It would converts the scalar "1234m/s" to
CP> the scalar "1234".
but that is not needed and will generate a warning under -w. you do, of
course, make sure your code is -w clean?
and the value you create there is not "1234" but 1234. those are
actually different scalar values even though they can be converted to
each other on the fly.
uri
--
Uri Guttman --------- uri@sysarch.com ---------- http://www.sysarch.com
SYStems ARCHitecture, Software Engineering, Perl, Internet, UNIX Consulting
The Perl Books Page ----------- http://www.sysarch.com/cgi-bin/perl_books
The Best Search Engine on the Net ---------- http://www.northernlight.com
------------------------------
Date: Tue, 09 Jan 2001 20:56:53 -0000
From: gbacon@HiWAAY.net (Greg Bacon)
Subject: Re: ASCII to integer conversion
Message-Id: <t5muolmbuntk31@corp.supernews.com>
In article <Pine.LNX.4.21.0101081542410.9913-100000@bleys.cs.uchicago.edu>,
anm imroz choudhury <aichoudh@cs.uchicago.edu> wrote:
: Is there a function in perl similar to the atoi() function in C that
: takes a string containing numerals, and outputs the integer that the
: string represents? I'd appreciate any help with this, thanks in
: advance.
You can do it both ways. You have to provide the digits in the base
and request a conversion. Decimal conversion looks like
$num =~ tr|0-9||dc; # dc == decimal conversion
To convert a decimal number to a string, use
$str =~ tr|0-9||cs; # cs == convert to string
Here's an example program:
#! /usr/bin/perl -w
use strict;
my $str = "12345";
# apply decimal conversion to $num
my $num = $str;
$num =~ tr|0-9||dc;
$num += 42;
# now convert to string so we can print it out
$str = $num;
$str =~ tr|0-9||cs;
print $str, "\n";
Hope this helps,
Greg
--
Health is merely the slowest possible rate at which one can die.
------------------------------
Date: 09 Jan 2001 16:26:53 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: ASCII to integer conversion
Message-Id: <m3y9wkwh5u.fsf@mumonkan.sunstarsys.com>
gbacon@HiWAAY.net (Greg Bacon) writes:
> In article <Pine.LNX.4.21.0101081542410.9913-100000@bleys.cs.uchicago.edu>,
> anm imroz choudhury <aichoudh@cs.uchicago.edu> wrote:
>
> : Is there a function in perl similar to the atoi() function in C that
> : takes a string containing numerals, and outputs the integer that the
> : string represents? I'd appreciate any help with this, thanks in
> : advance.
>
> You can do it both ways. You have to provide the digits in the base
> and request a conversion. Decimal conversion looks like
>
> $num =~ tr|0-9||dc; # dc == decimal conversion
>
> To convert a decimal number to a string, use
>
> $str =~ tr|0-9||cs; # cs == convert to string
I would have scored this a 10 if you managed to work "translate"
in there somewhere. Is this listed in the anti-FAQ ?
--
Joe Schaefer
------------------------------
Date: Tue, 09 Jan 2001 21:56:11 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: ASCII to integer conversion
Message-Id: <slrn95n25o.ghh.mgjv@verbruggen.comdyn.com.au>
On Tue, 09 Jan 2001 18:57:47 +0100,
Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> wrote:
> Martien Verbruggen wrote:
>>
>> On Tue, 09 Jan 2001 11:28:14 +0100,
>> Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl> wrote:
>> >
>> > See the problem? Now this of course can be easily fixed, the easiest
>> > (afaik) being by just adding the line (which also would be the answer to
>> > his question):
>> >
>> > $a_number += 0;
>>
>> Unfortunately, perl isn't quite _that_ smart. You'll have to extract the
>> number yourself. Watch:
>
> Actually, it works perfectly. It would converts the scalar "1234m/s" to
> the scalar "1234".
Quoting from my previous post, from the bit you cut, just below the
bit you quoted:
>> Perl's automagical conversion from strings to numbers works very much
>> like the strto*() functions in C, or the mentioned atoi() function.
>> Your string is allowed to start with whitespace, but the first
>> character has to be a numerical character (or + or -). In other words,
>> it has to be part of a valid number. Everything after that first valid
>> number is ignored. If your string starts with anything that isn't a
>> number, it'll become 0. Note that Perl will always warn if your string
>> isn't purely numerical.
I already said this, didn't I? As long as the first non-whitespace bit
in a string is a number, Perl will convert it to one (although it will
complain under -w). If it's not a number, it'll become 0 (and perl
will complain under -w).
You did read the whole post, didn't you?
Martien
--
Martien Verbruggen |
Interactive Media Division | In a world without fences, who needs
Commercial Dynamics Pty. Ltd. | Gates?
NSW, Australia |
------------------------------
Date: Tue, 09 Jan 2001 23:36:13 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93g4hd$6tf$1@news.news-service.com>
Uri Guttman wrote:
>
> then your program has a BUG in it. you didn't extract the number, you
> extracted a string which starts with a number. it is YOUR fault, not
> perl's. learn perl and stop thinking in c. scalars hold numbers or
> strings and there is no need to explicitly convert them. it is on your
> (the programmer's) head to make sure the data is meaningful in the
> proper contxt.
>
> sheesh!
>
> uri
Jesus Uri, read the f*cking thread. I'm not having any problems here
with Perl nor do any of my Perl programs, I'm just pointing out that
Perl's behavior can cause problems if you don't beware. With typecasting
you get an error at compile time if your variable is of the wrong type.
Perl's "I don't care 'cos there all scalars" can be cumbersome from time
to time. You *always* have to take into account that Perl can handle
something differently than you (or the user) expects.
------------------------------
Date: Tue, 09 Jan 2001 23:41:04 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93g4qh$6ue$1@news.news-service.com>
Uri Guttman wrote:
>
> CP> Actually, it works perfectly. It would converts the scalar "1234m/s" to
> CP> the scalar "1234".
>
> but that is not needed and will generate a warning under -w. you do, of
> course, make sure your code is -w clean?
>
> and the value you create there is not "1234" but 1234. those are
> actually different scalar values even though they can be converted to
> each other on the fly.
>
> uri
Oh jump of your soapbox, Uri. The quotes were not included to indicate
"strings" or whatever. Or do I now need to write my english in Perl
syntax also?
------------------------------
Date: Tue, 09 Jan 2001 23:49:20 +0100
From: Clifford Pennock <cliff@*MYLASTNAMEHERE*.nl>
Subject: Re: ASCII to integer conversion
Message-Id: <93g5a0$790$1@news.news-service.com>
Martien Verbruggen wrote:
>
> > Actually, it works perfectly. It would converts the scalar "1234m/s" to
> > the scalar "1234".
>
> Quoting from my previous post, from the bit you cut, just below the
> bit you quoted:
>
> >> Perl's automagical conversion from strings to numbers works very much
> >> like the strto*() functions in C, or the mentioned atoi() function.
> >> Your string is allowed to start with whitespace, but the first
> >> character has to be a numerical character (or + or -). In other words,
> >> it has to be part of a valid number. Everything after that first valid
> >> number is ignored. If your string starts with anything that isn't a
> >> number, it'll become 0. Note that Perl will always warn if your string
> >> isn't purely numerical.
>
> I already said this, didn't I? As long as the first non-whitespace bit
> in a string is a number, Perl will convert it to one (although it will
> complain under -w). If it's not a number, it'll become 0 (and perl
> will complain under -w).
>
> You did read the whole post, didn't you?
>
Actually, I did. And let me first say that I am very much suprised by
the incredible patronising that is going on here. Nobody has given the
original poster a "normal" answer yet. All you guys do is "we are
Perl-gods and can't be bothered with your petty questions".
That said, I don't think you have read all *my* posts entirely.
------------------------------
Date: Tue, 9 Jan 2001 14:32:41 -0500
From: "Eric" <eric.kort@vai.org>
Subject: Re: CGI vs Javascript dropdowns
Message-Id: <93fone$2ire$1@msunews.cl.msu.edu>
Ok, I'll take a crack at this, and look to the real experts to correct my
mistakes.
<damian_taylor@my-deja.com> wrote in message
news:93f3es$ju1$1@nnrp1.deja.com...
> Trouble is, I have recently found some perl examples that also do
> dynamic drop downs,
Not really. You have found perl scripts that generate dynamic html. Part
of what the perl script sent back to the client browser via the CGI pipeline
no doubt contained javascript to achieve the drop downs on the client's
browser.
> Does the CGI method load all the logic into memory at the initial load?
CGI is a protocol, perl and javascript are languages. A cgi file is
executed (it may be written in any of a variety of languages) and generates
html, which is sent to the browser. This may, of course, include embedded
javascript, etc. But when the web page is done loading, it's done loading.
Everything else occurs on the client machine as a result of the html, until
a new hyperlink is activated, in which case the server and the client
converse again. Here is a little overview of the process:
1. Click on link to "menu.cgi"-->request sent to web server.
2. Web server says "Hey, the requested file is a cgi file, not an html file.
I better try to execute it and return the results, if appropriate."
3. Web server executes the cgi file as appropriate (it will detect if it is
an executable binary, a perl script, or whatever).
4. The output of the file (which must start with the appropriate html
headers) is sent back to the web client as an html file.
5. The client browser displays the html file, including any dynamic java
script elements, etc.
No more communication between the server and the client occurs until another
hyperlink is clicked (except in the case of java applets which may maintain
an active connection to some server to display information like a telnet
session or flight status...but drop down menus are not an example of this,
they are simple dynamic html elements written in javascript and completely
embedded in the html).
The principle is basically the same with microsoft internet servers, just
substitute "ASP" for "CGI" (more or less) and "VBScript" for perl (more or
less).
> If it doesn't and the connection to the server is slow, would it be
> possible to have a long delay when the user changes a drop down while
> the server is working out, and sending back what the dependant drop
> downs should be?
This doesn't happen. See above.
> If there is no chance of a delay, it would seem CGI is the best route
> to take.
CGI is the ONLY route for generating interactive web pages on the fly, but
CGI may be utilized by perl, C, java, whatever. The result is always the
same: html sent to the client's browser.
hth, and I hope it is not too much of a glossing over the fine points for
the experts out there.
Eric
------------------------------
Date: Tue, 09 Jan 2001 20:18:04 GMT
From: mgrober@my-deja.com
Subject: drop in replacement for rlogind?
Message-Id: <93frln$7lb$1@nnrp1.deja.com>
Is there a drop in replacement in perl for rlogind? I need a way to access a
unix host via a web client calling a telnet client (QVT/Term or something
equivalent) using .rhosts authentication such that I can dump the user right
into a character based app and kill the session when he is down, BUT I can't
mess wth his .profile or existing shell. Soooo I thought the eaisest way to
do this was to replace the existing rlogind with something I could easily
modify to listen on whatever port I wished and provide the userwith whatever
shell/environment I want
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 09 Jan 2001 22:25:39 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Fork lots of children
Message-Id: <204n5t05d9f8mpcgokfjc41riomf9jfrm9@4ax.com>
Bill Buchan wrote:
>I've been using fork but I seem to have to create a child process, then
>spawn a child from the child, and a child from this child etc. until I
>have a whole heirarchy of children. This works but the code is a real
>mess.
>
>All I want is one parent and multiple children all at the same level in
>the process heirarchy. Is this possible?
Of course. Just let the PARENT do the spawning, not the child.
--
Bart.
------------------------------
Date: Tue, 09 Jan 2001 19:08:02 GMT
From: tim allen <timallen449@my-deja.com>
Subject: Re: How to humor a bad habit...?
Message-Id: <93fnid$4kt$1@nnrp1.deja.com>
In article <93dlvu$jac$1@nnrp1.deja.com>,
stefan@borgia.com wrote:
> If I have some code like this:
> $ini{'a'}{'a1'}='1';
> $ini{'a'}{'a2'}='2';
> How do I get:
> a1
> a2
To understand this, I had to learn that a hash of hashes is really a
regular hash, whose elements are scalar references to other (anonymous)
hashes.
To dereference a hash element which is a scalar reference, you do this:
print %{$ini{'a'}};
This works as well for hashes of arrays, arrays of hashes, etc.
Because they all are (hashes|arrays) which contain scalar references.
Try this:
#!/usr/bin/perl -w
use strict;
my %ini;
$ini{'a'}{'a1'}='1';
$ini{'a'}{'a2'}='2';
#this approach hardcodes the "outer" array reference
foreach (sort keys %{$ini{'a'}}) {
print "$_\n";
}
print "\n";
#this one doesn't hardcode the "outer" array
foreach (sort keys %ini) {
foreach (sort keys %{$ini{$_}}) {
print "$_\n";
}
}
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 9 Jan 2001 21:44:58 -0800
From: "Me" <ja@nee.snee>
Subject: How to process an &
Message-Id: <ZGb5YwneAHA.62@asd24-aux-005.raketnet.nl>
Hi Helpers,
When posting a form to my perl script, it gets processed the well known way.
Data comes in like this:
name=michel&icq=12345678&occ=engineer
which gets split and this is the result:
name=michel
icq=12345678
occ=engineer
Now what if I would like to send in the "occ" field of the form the
following text:
Systems Engineer & Controller
The script splits it like this:
name=michel
icq=12345678
occ=Systems Engineer
Controller=
That, ofcourse is useless.....
So... what do I do to get the result like this:
name=michel
icq=12345678
occ=Systems Engineer & Controller
Thank you for helping :)
Michel
------------------------------
Date: 09 Jan 2001 16:16:00 -0500
From: Joe Schaefer <joe+usenet@sunstarsys.com>
Subject: Re: How to process an &
Message-Id: <m33desxw8f.fsf@mumonkan.sunstarsys.com>
"Me" <ja@nee.snee> writes:
> Hi Helpers,
grrr. Not "helpers" - maniacs, usenauts, fellow programmers, etc. This is
not a help desk.
> When posting a form to my perl script, it gets processed
> the well known way.
That would be CGI.pm you are referring to?
>
> name=michel&icq=12345678&occ=engineer
> which gets split and this is the result:
>
> name=michel
> icq=12345678
> occ=engineer
Looks fine- "&" is the separator of key-value pairs
("=" separates key from value), and has this "special"
meaning within a query string, cookies, and/or
post-data from a form.
> Now what if I would like to send in the "occ" field of the form the
> following text:
>
> Systems Engineer & Controller
You have to encode all the "special" characters in the string:
" " and "&" are special here. They probably need to be url-escaped.
Of course, none of this is necessarily Perl-related, so without
showing your code, there's little more help anyone can offer
you here. Try a cgi newsgroup for more help with this.
HTH.
--
Joe Schaefer
------------------------------
Date: 9 Jan 2001 20:10:05 GMT
From: bmetcalf@nortelnetworks.com (Brandon Metcalf)
Subject: Re: Is $? set when using backticks to issue a system command
Message-Id: <93fr6t$sao$1@bcarh8ab.ca.nortel.com>
brannon@lnc.usc.edu writes:
> PerlFAQ Server <faq@denver.pm.org> writes:
>
> > $exit_status = system("mail-users");
> > $output_string = `ls`;
>
> Can I still get return status of the process with $?
Obviously you don't know how to read the manual. Hmm, let's look in the
perlvar man page. Hey, what do you know...
$? The status returned by the last pipe close, backtick
(``) command, or system() operator. Note that this
is the status word returned by the wait() system
call, so the exit value of the subprocess is
actually ($? >> 8). Thus on many systems, $? & 255
Brandon
------------------------------
Date: 9 Jan 2001 20:00:21 GMT
From: dha@panix2.panix.com (David H. Adler)
Subject: Re: Jobs: Senior Software Engineer
Message-Id: <slrn95mrel.c04.dha@panix2.panix.com>
On Tue, 09 Jan 2001 17:58:14 GMT, jatgal wrote:
>Title: Senior Software Engineer / Software Architect
>Availability:
Irrelevant.
You have posted a job posting or a resume in a technical group.
Longstanding Usenet tradition dictates that such postings go into
groups with names that contain "jobs", like "misc.jobs.offered", not
technical discussion groups like the ones to which you posted.
Had you read and understood the Usenet user manual posted frequently
to "news.announce.newusers", you might have already known this. :) (If
n.a.n is quieter than it should be, the relevent FAQs are available at
http://www.faqs.org/faqs/by-newsgroup/news/news.announce.newusers.html)
Please do not explain your posting by saying "but I saw other job
postings here". Just because one person jumps off a bridge, doesn't
mean everyone does. Those postings are also in error, and I've
probably already notified them as well.
If you have questions about this policy, take it up with the news
administrators in the newsgroup news.admin.misc.
There is a Perl Jobs Announce list that may be more helpful to you. See
<http://www.pm.org/mailing_lists.shtml> for details.
Yours for a better usenet,
dha
--
David H. Adler - <dha@panix.com> - http://www.panix.com/~dha/
We went on holiday by mistake - Withnail
------------------------------
Date: Tue, 09 Jan 2001 22:45:03 GMT
From: jos_hunter_9@my-deja.com
Subject: Mysterious Perl problem
Message-Id: <93g49e$ej8$1@nnrp1.deja.com>
hi guys,
This is a strange problem that I face in my web-based CGI application
of about 100,000 line of perl code. I work on Windows NT (service pack
4). Server is IIS. And use oraperl to talk to Oracle7.0 database.
The Perl interpreter arbitrarily crashes when certain links or buttons
in the application are clicked. The behavior is very arbitrary. Some
workarounds (some don't make sense but sometimes work) are :
1. Click the offending link in a new browser window.
2. Close the browser session and restart the application in a new
browser session.
3. Reboot the system.
4. Wait an arbitrary amount of time and the problem goes away.
5. Put exit(0) or gothere() or something insane like "$a=0" and then
problems goes away.
After that even if you undo the changes the problem goes away.
It seems that on Unix platforms I don't see this problem. I have no
clue why it crashes but I assume it is a memory related problem.
Any thoughts will be appreciated.
J
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 09 Jan 2001 22:37:14 GMT
From: Benjamin Clark <eblitzkrieg@hotmail.com>
Subject: Negating an RE within Perl
Message-Id: <93g3qq$e68$1@nnrp1.deja.com>
Hi,
I wish to write an exclusion RE in terms of what I want *left*.
Code (which is hardcoded, and I'd rather not change across the board):
$string !~ $re;
eg. a file containing:
hello there - line 1
ABC 123 - line 2
final line - line 3
and an exclude rule that is "^eg|^final" would return the ABC line.
Problem is, I wish to write the exclude rule in the context of the
string ABC. Can I do it without using pattern modifiers like s///c or
changing the !~ to =~?
I have tried "^[^A][^B][^C]" (which unfortunately doesn't match only
ABC, but also qBq and qqC) and "^[^(ABC)]" to no avail.
Help?
Cheers,
Ben.
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 09 Jan 2001 22:22:04 GMT
From: John Galt <ssomneb@my-deja.com>
Subject: Re: perl / CGI backend to change a user's unix password ?
Message-Id: <93g2u6$djq$1@nnrp1.deja.com>
I am working on a similar problem (though far easier), and I haven't
gotten it to work.
What I'm trying to do is change my password on my linux machine using a
perl program. I'm probably skipping something very simple.
Here are the basics of what I'm doing:
#!/usr/bin/perl
open PASS, "|passwd" or die "Can't open $!";
print PASS "abc123\n";
print PASS "abc123\n"; #It's there twice because it asks for the new
#password twice
I was expecting that to change the password, but the best I can do is
get a "passwd: Conversation error". Any ideas? Am I piping it wrong?
I apparently don't have a --stdin option, I tried that too.
I haven't found anything that explains piping really well... hopefully
somebody out there can help.
Thanks!
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Tue, 09 Jan 2001 21:22:12 +0100
From: Nico Wieland <wieland@netvertising.ch>
Subject: Re: perl socket programming questions
Message-Id: <3A5B72F4.90727B7D@netvertising.ch>
thanks to all who replied, also jeffrey grace who replied to me
directly. my apologies if my description was not clear enough, but
english is not my mother language and the whole project is somewhat
complicated.
best regards,
nico
> > any help would be much appreciated.
>
> The first thing, and I don't mean this unkindly, you need to do is to
[snip]
i don't mean this unkindly either, but: i might not be a senior unix
system designer, in fact no senior programmer at all (yet). but, i'm not
that uneducated that i would ask questions i don't understand at all (i
hope)... it's just so that one (i) can't know everything in advance, but
that doesn't necessarily mean that one doen't know anything at all. in
either case, the answers have been perfectly helpful to me. thanks
again.
------------------------------
Date: Tue, 09 Jan 2001 23:01:15 GMT
From: mustbe@pdelahunta.cjb.com (Paul Delahunta)
Subject: Standard Perl docs
Message-Id: <3a5b97eb.2905179@news.planet.nl>
I downloaded both the ActiveState Perl distribution and Indigo Perl
and it stroke me that the documentation each came with differs (i.e.
IndigoPerl is more extensive), where both speak of "the core Perl
documentation".
Is there a bundle of docs that can be called "the core Perl
documentation"? ^^^
And if so, where is this list of docs defined?
Perhaps knowing this would restrain a lot of people (myself
including) from continuously posting the same beginnersquestions to
this (and other) lists.
Kind regards,
Paul Delahunta
(I posted this message to both <comp.lang.perl.misc> and
<comp.lang.per>)
------------------------------
Date: Tue, 09 Jan 2001 20:47:27 GMT
From: jerome@activeindexing.com (Jerome O'Neil)
Subject: Re: Stopping users from exploiting Perl 'interpreter' on NT
Message-Id: <zNK66.2525$aU3.228726@news.uswest.net>
"Clyde Ingram" <cingram-at-pjocs-dot-demon-dot-co-dot-uk> elucidates:
>> Yes. You write policy that says "Thou shalt not ... " and if they do,
>> you fire them.
>>
>> I'm unsure as to why you would hire someone you don't trust in the
>> first place, but I guess thats your issue.
>
> Oops, you miss the point: we do not hire people we do not trust, but we have
> to secure the system as best we can against unscrupulous employees of our
> customer. Clearly we cannot control our customer's employment policy: you
> are wrong to guess that's our issue.
I see. Then you should explain to your customer that they have a personnel
problem, not a technology problem. It is best solved by enforcing policy
than trying to simultaneously deny and grant access to a system resource.
--
If men could learn from history, what lessons it might teach us! But
passion and party blind our eyes, and the light which experience gives
is a lantern on the stern, which shines only on the waves behind us.
--Samuel Taylor Coleridge, "Recollections"
------------------------------
Date: 9 Jan 2001 19:14:38 GMT
From: Jim Monty <monty@primenet.com>
Subject: Re: String length
Message-Id: <93fnuu$kuk$1@nnrp1.phx.gblx.net>
jos_hunter_9@my-deja.com wrote:
> Is there a direct way of finding the string length of a string in Perl?
perldoc -f length
--
Jim Monty
------------------------------
Date: Tue, 09 Jan 2001 19:34:18 GMT
From: woodywit@my-deja.com
Subject: Re: String length
Message-Id: <93fp3q$5nb$1@nnrp1.deja.com>
> Is there a direct way of finding the string
> length of a string in Perl?
Ja, use the length( ) function.
For instance:
$str = "donde";
$ret = length( $str );
print "string length is $ret\n";
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: 9 Jan 2001 20:09:27 GMT
From: "Fing Lamer" <flamer@primenet.com>
Subject: Taking control
Message-Id: <01c07a77$5d9ad920$LocalHost@webmaster>
My boss noticed people come to our web site but don't buy much of our
stuff. So he asked me to write a program to:
1. Make sure our site always comes first in search engine listings.
2. Force people to come to our site even if another listing looks more
attractive.
3. Make them stay on our site until they buy something.
4. Wipe out their hard disk if they leave without buying anything.
Can this be done in Perl? Could you please post the code for this program?
I hope it will be available for free even though it would make us a
bazillion dollars. Thank you.
------------------------------
Date: Tue, 09 Jan 2001 22:48:58 +0000
From: Greg Griffiths <greg2@surfaid.org>
To: Fing Lamer <flamer@primenet.com>
Subject: Re: Taking control
Message-Id: <3A5B955A.DA29957@surfaid.org>
Fing Lamer wrote:
> My boss noticed people come to our web site but don't buy much of our
> stuff. So he asked me to write a program to:
>
> 1. Make sure our site always comes first in search engine listings.
You'll just need to market your site to search engines successfully, check out
sites such as http://www.searchenginewatch.com for more info.
>
> 2. Force people to come to our site even if another listing looks more
> attractive.
You can't, if you include copyrighted keyword or trademarks that you don't
own, then you will face prosecution.
>
>
> 3. Make them stay on our site until they buy something.
You can't, they'll just quit the browser, or move elsewhere, this attitude is
hardly likely to endear you site to users.
>
>
> 4. Wipe out their hard disk if they leave without buying anything.
>
NO CHANCE, it would certainly not make you a popular site now would it ?
>
> Can this be done in Perl? Could you please post the code for this program?
> I hope it will be available for free even though it would make us a
> bazillion dollars. Thank you.
------------------------------
Date: Tue, 09 Jan 2001 22:12:45 GMT
From: mgjv@tradingpost.com.au (Martien Verbruggen)
Subject: Re: trying to count words - not working
Message-Id: <slrn95n34q.ghh.mgjv@verbruggen.comdyn.com.au>
On Tue, 09 Jan 2001 13:51:15 GMT,
Rick Delaney <rick.delaney@home.com> wrote:
>
> Martien Verbruggen wrote:
>>
>> Joe Schaefer <joe+usenet@sunstarsys.com> wrote:
>> > cberry@cinenet.net (Craig Berry) writes:
>>
>> I think Bart was talking about the code that Ala submitted,
>
> Bart?
Ack.... sorry, Craig. And sorry, Craig. Don't know how that happened.
Martien
--
Martien Verbruggen | My friend has a baby. I'm writing
Interactive Media Division | down all the noises the baby makes so
Commercial Dynamics Pty. Ltd. | later I can ask him what he meant -
NSW, Australia | Steven Wright
------------------------------
Date: 16 Sep 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 16 Sep 99)
Message-Id: <null>
Administrivia:
The Perl-Users Digest is a retransmission of the USENET newsgroup
comp.lang.perl.misc. For subscription or unsubscription requests, send
the single line:
subscribe perl-users
or:
unsubscribe perl-users
to almanac@ruby.oce.orst.edu.
| NOTE: The mail to news gateway, and thus the ability to submit articles
| through this service to the newsgroup, has been removed. I do not have
| time to individually vet each article to make sure that someone isn't
| abusing the service, and I no longer have any desire to waste my time
| dealing with the campus admins when some fool complains to them about an
| article that has come through the gateway instead of complaining
| to the source.
To submit articles to comp.lang.perl.announce, send your article to
clpa@perl.com.
To request back copies (available for a week or so), send your request
to almanac@ruby.oce.orst.edu with the command "send perl-users x.y",
where x is the volume number and y is the issue number.
For other requests pertaining to the digest, send mail to
perl-users-request@ruby.oce.orst.edu. Do not waste your time or mine
sending perl questions to the -request address, I don't have time to
answer them even if I did know the answer.
------------------------------
End of Perl-Users Digest V10 Issue 26
*************************************