[12901] in Perl-Users-Digest
Perl-Users Digest, Issue: 311 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Fri Jul 30 09:17:17 1999
Date: Fri, 30 Jul 1999 06:10:11 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Perl-Users Digest Fri, 30 Jul 1999 Volume: 9 Number: 311
Today's topics:
Re: How to determine a date in the past <tchrist@mox.perl.com>
Re: How to trim a String <tchrist@mox.perl.com>
Re: is process still running? <tchrist@mox.perl.com>
Perl Mongers <james.williamson@bbc.co.uk>
Re: Printing lines BTW two strings in file (NOT!) <tchrist@mox.perl.com>
Re: Printing lines BTW two strings in file (NOT!) <tchrist@mox.perl.com>
Re: Re: How to read the submit button as a name or valu <tchrist@mox.perl.com>
Re: running Perl and Linux from a boot-cd? <thomas@bibsyst.no>
Re: Seeking good Perl Examples <tchrist@mox.perl.com>
Sorting by more than one variable !? (Ryan Ngi)
submit to another form (cim)
Re: using sendmail in .pl <anfi@bigfoot.com>
Re: Why is this regexp not working ? (Bart Lateur)
Re: Why is this regexp not working ? (Mike Bristow)
Re: Win32::OLE or something else ??? (Michel Dalle)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 30 Jul 1999 06:27:06 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to determine a date in the past
Message-Id: <37a19a1a@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc, abigail@delanet.com writes:
:Several. The most complete one is Date::Manip. That will let you count
:back in English, French, Dutch, Swedish, Polish, German, Spanish, and
:Portuguese, using normal days or business days, and in free form as well!
Its author always leaves me with those feelings of inadequacy that stem
from being an uneducated American. :-)
--tom
--
The reductionist approach has its place, as does the holistic approach.
Render therefore unto Unix the things which are Unix's, and unto Perl
the things that are Perl's. :-) Larry Wall in <1994Nov10.185030.16615@netlabs.com>
------------------------------
Date: 30 Jul 1999 06:34:36 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: How to trim a String
Message-Id: <37a19bdc@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
abigail@delanet.com writes:
:Tom will even bounce your mail if he replies on a reply of a posting
:made from AOL, and you Cc: him on a reply you make to his posting.
It checks both the From: and the Reply-To: lines. It should not
be checking the In-Reply-To: lines. I don't see why yours was bounced,
unless you're sending mail and setting your reply-to to a bad place.
--tom
--
"That's okay. Anyone whose opinion he cares about already knows that
he doesn't care about their opinion."
--Larry Wall
------------------------------
Date: 30 Jul 1999 05:52:41 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: is process still running?
Message-Id: <37a19209@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
abigail@delanet.com writes:
:[] Another interesting signal to send is signal number zero.
:[] This doesn't actually affect another process, but instead
:[] checks whether it's alive or has changed its UID.
:
:It could be they meant "but instead checks whether it's alive and
:has not changed its UID".
Patches welcome. :-)
:Which means that depending on the two cases above, if the process has
:changed UID, a kill 0 might give a false positive, or a false negative.
:
:Am I missing something, or is the documentation wrong?
Perhaps it's just the victim of a failed De Morgan transform. :-)
The answer is different in one case than in the other.
${"it's alive"} = kill(0, $hispid);
${"its uid has changed"} = !kill(0, $hispid);
Those don't give the same answers from the same call. But that's ok,
because the word "whether" comprises two states. I guess you could
write:
${"its uid hasn't changed"} = kill(0, $hispid);
or
${"it's alive and its uid hasn't changed"} = kill(0, $hispid);
Of course, we're assuming that $hispid is positive here.
--tom
--
"111% of crap is everything." --Larry Wall
------------------------------
Date: Fri, 30 Jul 1999 13:05:20 +0100
From: "James Williamson" <james.williamson@bbc.co.uk>
Subject: Perl Mongers
Message-Id: <7ns4gh$i8m$1@nntp0.reith.bbc.co.uk>
I was reading the other day about PerlMongers and was pretty intrigued to
know if there was a group in London (UK). What sort of people participate in
these get togethers?
James
------------------------------
Date: 30 Jul 1999 06:43:16 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Printing lines BTW two strings in file (NOT!)
Message-Id: <37a19de4@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
Uri Guttman <uri@sysarch.com> writes:
:that is better done as:
: @eks_file = <EKS_FILE> ;
: foreach $line ( @eks_file ) {
I despise reading that. Please don't suggest it without
the mandatory paragraph of disclaimer explaining why it's
almost always a stupid idea.
--tom
--
Thou shalt run lint frequently and study its pronouncements with care, for
verily its perception and judgement oft exceed thine.
--1st commandment for C programmers
------------------------------
Date: 30 Jul 1999 06:51:53 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Printing lines BTW two strings in file (NOT!)
Message-Id: <37a19fe9@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
chris dawson <cmd@maths.uq.edu.au> writes:
:I was under the impression that <EKS_FILE> returned the next line, not
:the whole file.
Depends.
:I would do something like this
:
:while ($line=<EKS_FILE>) {
: push @eks_file, $line;
:}
That's usually the wrong thing. I really wish beginners wouldn't
pick up bad habits like this. When's the last time that you saw
a C programmer read a whole file into an array? Rarely. Very rarely.
Virtually always you do incremental processing. It's the Perl way:
while (<>) {
# do something with the line
# then go get the next one, abandoning this one
}
This standard linewise processing model is one of the most
important of Perl idioms, and should be amongst the first one
anyone learns. When you see
@lines = <>;
for (@lines) { ..... }
you cannot help but wonder what else is wrong with the code.
--tom
--
Education is the best provision for old age. --Aristotle
------------------------------
Date: 30 Jul 1999 06:31:29 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Re: How to read the submit button as a name or value
Message-Id: <37a19b21@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"Vox" <v0xman@yahoo.com> writes:
:%% To get the users input and configure it I do the code below:
:%%
:%% read(STDIN, $input, $ENV{'CONTENT_LENGTH'})
:
:Abigail>Stop! Do not use such code. Why don't you use CGI.pm?
:
:
:What do you mean by 'Do not use such code'. It works fine for getting the
:input from users and what is CGI.pm?
It's wrong, in many ways. First, it assumes that no one will ever use
a GET. Second and worst, read() does not raise an exception on failure.
That's up to you, and you failed.
Never do form-cracking by hand. People who've written their own web
browsers and the author of CGI.pm are exempt, but the rest of you, SHAME!
--tom
--
"That must be wonderful! I don't understand it at all."
------------------------------
Date: Fri, 30 Jul 1999 13:38:36 +0200
From: Thomas Weholt <thomas@bibsyst.no>
Subject: Re: running Perl and Linux from a boot-cd?
Message-Id: <37A18EBC.48EBAEF4@bibsyst.no>
> CD, and use it just as any other installed system. Ask the folks
> at www.suse.de about how to make a bootable CD that includes perl.
Yes. I might do that...
------------------------------
Date: 30 Jul 1999 07:00:40 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: Seeking good Perl Examples
Message-Id: <37a1a1f8@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
"James Nedham" <James_Nedham@ml.com> writes:
:I am a newbie seeking good Perl examples, not CGI scripts.
Here is a list of places to find examples of Perl code:
All code from _The_Perl_Cookbook_:
ftp://ftp.oreilly.com/published/oreilly/perl/cookbook/
The Perl Power Tools Unix Reconstruction project:
http://language.perl.com/ppt/
My own script archive:
http://www.perl.com/CPAN-local/authors/id/TOMC/scripts/
--tom
--
That's their goal, remember, a goal that's really contrary to that of
the programmer or administrator. We just want to get our jobs done.
$Bill just wants to become $$Bill. These aren't even marginallly
congruent. --Tom Christiansen in <6jhtqk$qls$1@csnews.cs.colorado.edu>
------------------------------
Date: Fri, 30 Jul 1999 12:07:28 GMT
From: ryanngi@hotmail.com (Ryan Ngi)
Subject: Sorting by more than one variable !?
Message-Id: <37a193d8.13596149@news.inet.co.th>
give
$Hash{James} = [200,10];
$Hash{Jack} = [150,10];
$Hash{John} = [140,15];
$Hash{Jim} = [150,15];
by sorting the [1] of array if the [1] of array is equal then perform
second sort on [0]
...... i expect the result as
Jack James John Jim
how to implement the clean algorithm for this job !?
------------------------------
Date: Fri, 30 Jul 1999 11:51:38 GMT
From: cim@local.ee (cim)
Subject: submit to another form
Message-Id: <37a19048.241188517@news.uninet.ee>
I have a form and it posts to a perl script
(content -> id=123&page=2 .....)
the script then processes the form and writes the data.
What I need is that this data (content from the form) is also posted
to another form on a different server (running similar script).
Anyone. help.
------------------------------
Date: Fri, 30 Jul 1999 13:28:43 +0200
From: Andrzej Filip <anfi@bigfoot.com>
Subject: Re: using sendmail in .pl
Message-Id: <37A18C6B.3366CAE7@bigfoot.com>
David Cassell wrote:
> Andrzej Filip wrote:
> > [snip]
> > open( MAIL, "| /usr/lib/sendmail -oi -t") or die "Can't open sendmail\n";
> > # -t - get recipient list from headers
> > # -oi - single dot is not end of message
> > my BCC='name@domain.com';
>
> This won't even compile. Did you mean $bcc instead of BCC ?
> I prefer to use all-upper-case only for filehandles and
> dirhandles, myself.
My mistake:
my $BCC='name@domain.com';
> > print MAIL << "THE_END" ;
> > Subject: test
> > BCC: ${BCC}
>
> You don't need curly brackets around BCC here. Just $bcc
> [my notation, not yours] would do.
I know it but I prefer to use curly brackets in "here documents"
for readability.
> > [snip of rest]
>
> I don't mean to be a pain [well I guess I do mean to be a pain,
> but I don't want to offend you]. But good code is important
> when newbies are reading it. They won't know the difference
> until someone tells them.
I know it too.
--
Andrzej (Andrew) A. Filip | Warsaw, Poland | fax: +1(801)327-6278
anfi@bigfoot.com | anfi@polbox.com | http://bigfoot.com/~anfi
Postings: http://deja.com/profile.xp?author=Andrzej%20Filip
Who refuses a better job offer ?
------------------------------
Date: Fri, 30 Jul 1999 11:12:45 GMT
From: bart.lateur@skynet.be (Bart Lateur)
Subject: Re: Why is this regexp not working ?
Message-Id: <37a1887b.5078145@news.skynet.be>
marcza@my-deja.com wrote:
>a word char (\w = [a-zA-Z_]) or a space.
>BUT: The last char is a digit.
Word chars (no "locale") include [a-ZA-Z_0-9].
Bart.
------------------------------
Date: Fri, 30 Jul 1999 11:45:06 GMT
From: mike@fat.dotat.at (Mike Bristow)
Subject: Re: Why is this regexp not working ?
Message-Id: <slrn7q3422.1k0.mike@lindt.fat.dotat.at>
On Fri, 30 Jul 1999 10:35:20 GMT, marcza@my-deja.com <marcza@my-deja.com> wrote:
>Assume the following:
>
>$currline = "Date: 23.05.1999";
>if ($currline =~ /([ \w]{1,20})$/) {
> print "matched\n"; }
>
>Surprisingly currline IS MATCHED. Why ?
>I mentioned "$" at the end of the regexp. That means from my point
>of view that the last character of currline must be
>a word char (\w = [a-zA-Z_]) or a space.
>BUT: The last char is a digit. So the reg exp shouldn't match. But it
>does.
Why did you fail to understand perlre?
From TFM:
\w Match a "word" character (alphanumeric plus "_")
It seems clear to me, perhaps you could suggest an alternate
wording so others don't make the same mistake after reading
the documentation.
You /did/ read the documentation, didn't you?
--
Mike Bristow, Geek-At-Large. GK/RT0038
one tequila - two tequila - three tequila - FLOOR !!!
------------------------------
Date: Fri, 30 Jul 1999 12:22:14 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: Win32::OLE or something else ???
Message-Id: <7ns5h6$sh6$1@news.mch.sbs.de>
In article <37A17D38.5D251A31@ti.com>, w-woerlinger@ti.com wrote:
>Hallo,
>
>I'm writing a program that allows me to let's say 'remote control'
>a web browser (I used InternetExplorer 50) with a macro-editor
>created procedure.
>
>To be able to continue accessing the browser, I need to know when
>the browser has finished loading the current page or applet.
>But so far I haven't found any way of how to get this information
>automatically:
>
>I tried
> a) Win32::OLE, but this only gives back ProgramName,program-path,
> window-size, window-position,...
Here's a VERY rough procedure for getting all the links of a page
downloaded with IE4 :
#!/usr/local/bin/perl -w
use Win32::OLE;
my $browser = Win32::OLE->new('InternetExplorer.Application', 'Quit')
or die "Can't load IE : $!";
$browser->Navigate2("http://www.perl.com/");
while ($browser->Busy) {
print ".";
sleep(1);
}
print "\n";
my $url = $browser->LocationURL;
print "Links on page $url :\n";
my $enum = Win32::OLE::Enum->new($browser->Document->links);
while (defined(my $link = $enum->Next)) {
print "($link->{'tagName'}) $link->{'href'}\n";
}
undef $enum;
$browser->Quit();
undef $browser;
exit;
You should probably add some timeouts, and check whether Document-
Complete is true, etc.
Have fun,
Michel.
--
aWebVisit - extracts visitor information from WWW logfiles and shows
the top entry, transit, exit and 'hit&run' pages, the links followed
inside your website, the time spent per page, the visit duration etc.
For more details, see http://gallery.uunet.be/Michel.Dalle/awv.html
------------------------------
Date: 1 Jul 99 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 1 Jul 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.
To submit articles to comp.lang.perl.misc (and this Digest), send your
article to perl-users@ruby.oce.orst.edu.
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.
The Meta-FAQ, an article containing information about the FAQ, is
available by requesting "send perl-users meta-faq". The real FAQ, as it
appeared last in the newsgroup, can be retrieved with the request "send
perl-users FAQ". Due to their sizes, neither the Meta-FAQ nor the FAQ
are included in the digest.
The "mini-FAQ", which is an updated version of the Meta-FAQ, is
available by requesting "send perl-users mini-faq". It appears twice
weekly in the group, but is not distributed in the digest.
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 311
*************************************