[17696] in Perl-Users-Digest
Perl-Users Digest, Issue: 5116 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Thu Dec 14 18:15:37 2000
Date: Thu, 14 Dec 2000 15:15:20 -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: <976835720-v9-i5116@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Thu, 14 Dec 2000 Volume: 9 Number: 5116
Today's topics:
pipes (Evanda Remington)
Re: pipes (Colin Watson)
Re: Please help with this script! Weird problem <mikelin6@home.com>
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Chris Fedde)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tad McClellan)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tad McClellan)
Re: Posting Guidelines for comp.lang.perl.misc ($Revisi (Tad McClellan)
Re: quick way to search array members <ren.maddox@tivoli.com>
Re: Regex can't be greedy with /(a|ab)/ ? <bart.lateur@skynet.be>
Re: Removing Whitespace Question nobull@mail.com
Re: Removing Whitespace Question (Richard Zilavec)
Re: Removing Whitespace Question <bcaligari@my-deja.com>
Re: Tutorial for DBI module and MySQL <edwardj@ameritech.perl.net>
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 14 Dec 2000 19:41:47 GMT
From: evanda@ater.org (Evanda Remington)
Subject: pipes
Message-Id: <slrn93i8jr.6j7.evanda@mist.ater.org>
I'm using a pipe to try to talk to a child process and the child
process is exec'ing passwd.
before i can give it any input, it's coming back with an error saying
that i gave it the wrong thing (the error indicates an empty string,
and then enter.
is this because the pipes aren't being flushed or soemthing? what's
the standard way of doing that?
-e
--
Evanda Remington
evanda@ater.org
http://www.ater.org
------------------------------
Date: 14 Dec 2000 20:21:45 GMT
From: cjw44@flatline.org.uk (Colin Watson)
Subject: Re: pipes
Message-Id: <91ba4p$tmj$1@riva.ucam.org>
Evanda Remington <evanda@ater.org> wrote:
>I'm using a pipe to try to talk to a child process and the child
>process is exec'ing passwd.
>
>before i can give it any input, it's coming back with an error saying
>that i gave it the wrong thing (the error indicates an empty string,
>and then enter.
passwd normally reads straight from a tty. You could try using Expect.pm
to simulate the presence of a terminal.
--
Colin Watson [cjw44@flatline.org.uk]
"Then hast thou joined the ARPANET? / Oh come to me, my bankrupt boy!
Quick, call the NIC! Send RFCs! / He chortled in his joy." - RFC 527
------------------------------
Date: Thu, 14 Dec 2000 21:05:13 GMT
From: Mike Lin <mikelin6@home.com>
Subject: Re: Please help with this script! Weird problem
Message-Id: <3A393795.244A9F2A@home.com>
Hey, thanks for all the replies but my question is about the actual script
which won't work unless I simply all the html down to almost nothing.
Unfortunately here is my situation. I have been assigned to write this
cgi-perl program at work and I just learned it two days ago so I don't know
all the in's and out's.
Also, I don't have a platform to test these perl scripts out. Basically, I
have to upload my script via ftp to a web host's UNIX server every time and
then open my browser to check to see if it works. Needless to say this is
very tedious every time I need to make changes.
I've tried installing Active Perl 6.0 (a form of perl 5.6) but since this
cgi-perl script interfaces with UNIX commands from the server and also html
commnads from the browser I can't really test out my scripts in Active Perl
from the windows platform I have at work. Needless to say I am not in the
ideal environment to be making these scripts...but enough complaining...
I mentioned this because somebody wrote that I should print out the error
message but I don't get anything except a generic browser error message
everytime my script doesn't work.
Also, to the guy who wrote:
>You've forgotten to print a header when you need it in your actual output.
>print<<"END";
><HTML><HEAD><TITLE>Error</TITLE>
>That should be
>print << "END";
>Content-type: text/html
> <HTML><HEAD>....
>Then, it should work for you.
I actually did this in my script I just didn't put it in the simple example I
wrote to illustrate my problem...so this is not what's wrong.
Basically, the script works without all the html formatting but it looks weird
because all the pages on my company's web site have layers, standard
backgrounds, and etc except for this page which looks completely different
since i can't get all the html formatting to work. The page printed out by
the cgi scripts looks real unprofessional compared to the rest.
Thanks
Mike
------------------------------
Date: Thu, 14 Dec 2000 21:42:02 GMT
From: cfedde@fedde.littleton.co.us (Chris Fedde)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <K8b_5.248$B9.188798976@news.frii.net>
In article <fr3h3t407s0891356u9ts8dufd7liqs4q6@4ax.com>,
Bart Lateur <bart.lateur@skynet.be> wrote:
>Chris Fedde wrote:
>
>>Here is one that Nathan Torkington used to post frequently.
>>It attempts to answer the question "How can I help my self to good
>>information about perl?" It is in the rotation with the faq postings.
>
>It looks remarkably much like the mail I got when I first posted to
>comp.lang.perl.misc with a new e-mail address. It got sent to every new
>poster (with an unmunged e-mail address -- duh!). Doesn't this happen
>any more?
>
Apparently it does.
chris
--
This space intentionally left blank
------------------------------
Date: Thu, 14 Dec 2000 10:14:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <slrn93hsf9.r2.tadmc@maxim.metronet.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
>John Stanley wrote:
>
>>> Do we want a "flag" in the Subject for filtering purposes?
>>
>>Yes. As opposed to Abigail, I want to see neither the FAQ nor any
^^^^^^^
^^^^^^^
>>responses to it, as all such articles will be off-topic.
^^^^^^^^^
^^^^^^^^^
>Doesn't your newsreader allow you to ignore threads containing articles
>of certain authors?
^^^^^^^
How would he know what authors are going to followup to the post?
The point is moot now anyway. John can just killfile based
on the Subject.
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Dec 2000 11:45:37 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <slrn93i1q1.r2.tadmc@maxim.metronet.com>
Chris Fedde <cfedde@fedde.littleton.co.us> wrote:
>In article <976710321.22736@itz.pp.sci.fi>,
>Ilmari Karonen <usenet11304@itz.pp.sci.fi> wrote:
>>
>> ... there are a number of measures that all of us can take to make
>> the group as useful as possible for everyone.
>>
>
>... there are a number of measures that we all should take to keep the group
>useful for everyone.
I think we have a winner!
I'll go with that one.
>(I feel like I'm writing Gore's latest speech ;-)
Err, that would be "!winner" rather than "winner!".
:-)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: Thu, 14 Dec 2000 12:11:33 -0600
From: tadmc@metronet.com (Tad McClellan)
Subject: Re: Posting Guidelines for comp.lang.perl.misc ($Revision: 0.1 $)
Message-Id: <slrn93i3al.r2.tadmc@maxim.metronet.com>
Bart Lateur <bart.lateur@skynet.be> wrote:
>John Stanley wrote:
>
>>I'm asking why you think that they will follow your
>>suggestions when they don't follow any others.
>
>But now these will be published guidelines. People ignoring these
>guidelines deserve all the flames they get.
But we are not _required_ to give them what they deserve.
We should, in fact, encourage folks to _not_ give them what
they deserve.
It would be nice if this newsgroup was, well... nicer.
(that sounds really strange considering the source...)
--
Tad McClellan SGML consulting
tadmc@metronet.com Perl programming
Fort Worth, Texas
------------------------------
Date: 14 Dec 2000 12:41:30 -0600
From: Ren Maddox <ren.maddox@tivoli.com>
Subject: Re: quick way to search array members
Message-Id: <m3y9xidew5.fsf@dhcp11-177.support.tivoli.com>
Bart Lateur <bart.lateur@skynet.be> writes:
> Chris Stith wrote:
>
> >A 50% time savings on average is signifigant.
>
> But will you always get that much savings? If every pass through your
> loop takes twice as long, there won't be any saving at all. So it all
> depends on how much code -- in high level Perl -- your loop body has to
> execute. A simple "last if condition" could increase the execution time
> per loop step by quite a few percents.
And that is exactly why "grep" is the *wrong* solution -- there's no
way to bail out early (well, you could grep within an eval and die to
bail out...).
In general, grep is not the correct way to test if a particular
element exists in an array. That doesn't mean that there aren't
specific cases where the benefit of its simplicity outweighs this
disadvantage. But based on what the OP asked, a hash seems like the
best solution. Of course, if the larger context really needs an
array for ordering, then a hash may or may not be appropriate.
--
Ren Maddox
ren@tivoli.com
------------------------------
Date: Thu, 14 Dec 2000 22:10:51 GMT
From: Bart Lateur <bart.lateur@skynet.be>
Subject: Re: Regex can't be greedy with /(a|ab)/ ?
Message-Id: <46hi3tskukijbobag8oh4rk47ts09ojan9@4ax.com>
Patrick Stein wrote:
>$string =~ /(a|ab)/;
>
>How can I match 'ab' without first sorting ? This regex will never match 'ab'
>and that's where the perl interpreter should complain.
>Sorting might help, but I think that perl might have a better way of finding
>'ab' ( especially if the strings you are looking for are coming from arrays )
>and the perl interpreter builds the matching trie or tree anyways.
No it hasn't. Greediness doesn't work that way, and I'm glad for it.
Perl tests alternatives from left to right, and stops at the first
succesful match. That is, in your case, an "a".
If these are literal strings, do a reverse sort by length.
@alt = qw(a ab);
@alt = sort { length($b) <=> length{$a} } @alt;
$" = '|';
/(@alt)/
If your regexes are not as simple, you really will have to manually tryd
different matches, and pick out the longest match.
--
Bart.
------------------------------
Date: 14 Dec 2000 19:30:11 +0000
From: nobull@mail.com
Subject: Re: Removing Whitespace Question
Message-Id: <u9ae9y6bss.fsf@wcl-l.bham.ac.uk>
rzilavec@tcn.net (Richard Zilavec) writes:
> $a =~ s/\s+$//;
>
> Seems to be the never ending topic.....
A matter not helped by people who post answers.
When someone asks a FAQ always respond RTFFAQ.
If you want to answer the question as well as directing them to the
FAQ that's OK as long as to beat them up a bit first.
If you give people the impression that posting without reading the FAQ
is acceptable then more people will do it and when they do get picked
up on it we'll have to come down even harder on them to help them
unlearn the behaviour. You may _think_ that by just answering the
question and not saying RTFFAQ you are being nice to the person. You
are deluding yourself. You are harming them as much as you are
harming the rest of us.
--
\\ ( )
. _\\__[oo
.__/ \\ /\@
. l___\\
# ll l\\
###LL LL\\
------------------------------
Date: Thu, 14 Dec 2000 19:45:38 GMT
From: rzilavec@tcn.net (Richard Zilavec)
Subject: Re: Removing Whitespace Question
Message-Id: <3a3c2337.178549885@news.tcn.net>
On 14 Dec 2000 19:30:11 +0000, nobull@mail.com wrote:
>When someone asks a FAQ always respond RTFFAQ.
>
>If you want to answer the question as well as directing them to the
>FAQ that's OK as long as to beat them up a bit first.
>
>If you give people the impression that posting without reading the FAQ
>is acceptable then more people will do it and when they do get picked
>up on it we'll have to come down even harder on them to help them
>unlearn the behaviour. You may _think_ that by just answering the
>question and not saying RTFFAQ you are being nice to the person. You
>are deluding yourself. You are harming them as much as you are
>harming the rest of us.
In future posts for sure.. thanks.
--
Richard Zilavec
rzilavec@tcn.net
------------------------------
Date: Thu, 14 Dec 2000 22:06:42 GMT
From: Brendon Caligari <bcaligari@my-deja.com>
Subject: Re: Removing Whitespace Question
Message-Id: <91bg9e$h5s$1@nnrp1.deja.com>
$s=~ s/\s*$//;
In article <Pine.GSO.3.96.1001214114353.14497A-
100000@armstrong.cse.Buffalo.EDU>,
Evil Jim <jsoliven@cse.buffalo.edu> wrote:
> Hi,
>
> I'm trying to remove whitespace from a string but I have no idea how
to do
> it. Basically, if we have a string
>
> $a = "blah-blahXXXXXXXXX"; (Where X is a whitespace character)
>
> I want to chop it down to just $a = "blah-blah"; Anyone know of any
> pattern translation for this? I appreciate any help anyone can offer.
>
> /jim
>
>
Sent via Deja.com
http://www.deja.com/
------------------------------
Date: Thu, 14 Dec 2000 16:30:02 -0600
From: Ed Jamison <edwardj@ameritech.perl.net>
Subject: Re: Tutorial for DBI module and MySQL
Message-Id: <3A3949EA.775FAE24@ameritech.perl.net>
O'Reilly's Programming the Perl DBI...
http://www.half.com/products/books/detail.cfm?item=890348&AID=167876&PID=216178
Dosen't get any better than this... (Or this price)
Mark Thompson wrote:
> Hi,
>
> I found the documentatino for using DBI with MySQL but I was wondering
> if there was a good tutorial available on using MySQL with Perl.
>
> Thanks,
>
> Mark
--
Ed Jamison
yapn
No, there's not really an ameritech.perl.net, tho that'd be cool.
Remove the .perl from my e-mail address to reply.
------------------------------
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 V9 Issue 5116
**************************************