[13007] in Perl-Users-Digest
Perl-Users Digest, Issue: 417 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sat Aug 7 23:05:58 1999
Date: Sat, 7 Aug 1999 20:05:07 -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 Sat, 7 Aug 1999 Volume: 9 Number: 417
Today's topics:
Re: a time to kill (Larry Rosler)
Re: a time to kill (Larry Rosler)
Re: Checking if an URL is true or false ? (Abigail)
Re: Checking if an URL is true or false ? (Bill Moseley)
Re: Does anyone know where I can find... (Abigail)
Re: Fork question: running for a short amount of time a (Anno Siegel)
Re: How? CPAN PODs? (Bill Moseley)
Re: How? <carvdawg@patriot.net>
Re: Is this an appropreate use of -i switch? (Bill Moseley)
Re: just days away f7.8ez5.88ox <flavell@mail.cern.ch>
Re: lstat on a unicode file in NT? (elephant)
Re: MATCH CASES AND PRINT TO A FILE (Alan Barclay)
Re: Nastiness contrary to the spirit of perl? (Darrell Stec)
Need Help - Connecting to HTTP <master@openendon.com>
Re: Newbie question about $_ <mike@crusaders.no>
Re: Nicer Way (Larry Rosler)
Re: object state maintained with Cookies? Is this poss <flavell@mail.cern.ch>
Precompliled perl5.005 for sun4 (Michael Ghens)
Re: rows to columns <tchrist@mox.perl.com>
Re: rows to columns (Anno Siegel)
Re: smrsh and Perl Script: unknown mailer error 13 (Mike D. Kail)
Re: System call in Win NT, AS Build 518 (elephant)
Digest Administrivia (Last modified: 1 Jul 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sat, 7 Aug 1999 16:51:40 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: a time to kill
Message-Id: <MPG.1216665be10f205f989e00@nntp.hpl.hp.com>
[Posted and a courtesy copy sent.]
In article <37ac56b2@cs.colorado.edu> on 7 Aug 1999 09:54:26 -0700, Tom
Christiansen <tchrist@mox.perl.com> says...
> In comp.lang.perl.misc,
> lr@hpl.hp.com (Larry Rosler) writes:
> :Note that all of the above are scored higher than merlyn. How's that
> :for an idiosyncratic value judgment?
>
> Ah; so that's what "idiosyncratic" means now. Fascinating. :-)
As you and Abigail seem to share that value judgment, perhaps a better
word would be bisyncratic. Don't look it up -- I just invented it, and
it means just what I choose it to mean -- neither more nor less.
Literary reference on that? (Not you, Tom -- it's too easy.)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sat, 7 Aug 1999 17:07:28 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: a time to kill
Message-Id: <MPG.12166a118aa4343a989e01@nntp.hpl.hp.com>
In article <slrn7qmi3h.9pa.fl_aggie@thepentagon.com> on 6 Aug 1999
20:39:09 GMT, I R A Darth Aggie <fl_aggie@thepentagon.com> says...
> On Fri, 6 Aug 1999 11:46:29 -0700, Larry Rosler <lr@hpl.hp.com>, in
> <MPG.1214cd5e6d4f221c989df0@nntp.hpl.hp.com> wrote:
...
> + > Out, out, you demons of stupidity!
> + 7. Mark, Luke, Acts
>
> Actually, St. Dogbert. Quoth Dilbert: I don't think I've ever seen your
> spiritual side before. Had the demons been cast out into a herd of swine,
> then you may have been onto something.
>
> Of course, those particular demons were called LEGION. Sounds vaguely
> familiar...legions of newbies...
TomC pointed out that in 'outing' the Biblical demons, I overlooked the
Macbeth fusion/allusion there. Too true.
> + What did I miss, anyone?
>
> You asked...
And here are a few more Shakespearean semi-stretches from the same
corpus, which I missed on the first pass:
The quality of postings from these sites is too low to bother annoying
oneself with by reading:
Merchant of Venice
First we kill anybody so clueless as not to include lower-case letters
in their subject.
Henry VI Part 2
Dead dead dead dead.
King Lear
In some ways this exercise is too easy, because Modern English has
primarily two major sources of literary expression: Shakespeare and the
Authorized Version.
I wish I could think of Perlish content now. Oh well, it's the weekend.
TomC has all summer to play, evidently. I get the weekend.
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: 7 Aug 1999 18:32:34 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Checking if an URL is true or false ?
Message-Id: <slrn7qpgg4.1dr.abigail@alexandra.delanet.com>
Bruno Baguette (bruno.baguette@francemel.com) wrote on MMCLXVII September
MCMXCIII in <URL:news:7oi730$h23$1@nnrp1.deja.com>:
!! Hello,
!!
!! I would like to check if an URL is true or false.
That's easy. Intersecting the false values of Perl with RFC 1738
gives you an empty set. One could argue about relative URLs though.
!! So, i think i should check the code that the server send when you go on
!! an url... (For example : If you try to get a bad url, you get the 404
!! code...)
!!
!! So, i should check if the code begin with 2. All codes beginning with 2
!! means that the request was succesfull... (I've seen that in the "Teach
!! yourself CGI programming with Perl in a Week" book written by Eric
!! Herrmann)
I'd say that if you think 204 is ``true'', 402 should be ``true'' as well.
And what about 101 or 30x? Or a 411?
!! So, the really big question is : How can i get this code ?
Check the first 3 bytes of the servers response. BTW, didn't "Teach yourself
CGI programming with Perl in a Week" tell you that? Or did it never come
past the first 2 bytes?
!! And the other question is : Do you think my idea good to check the URL ?
No.
Abigail
--
perl -we 'print split /(?=(.*))/s => "Just another Perl Hacker\n";'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: Sat, 7 Aug 1999 16:57:07 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Checking if an URL is true or false ?
Message-Id: <MPG.121667b32b3cd29198968f@nntp1.ba.best.com>
>
> Bruno Baguette <bruno.baguette@francemel.com> wrote in message
> > I would like to check if an URL is true or false.
>
Trond Michelsen (mike@crusaders.no) seems to say...
> perldoc LWP
Be warned that not all servers respond correctly to a HEAD
request. If a HEAD request fails, then try GET.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: 7 Aug 1999 18:33:50 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Does anyone know where I can find...
Message-Id: <slrn7qpgih.1dr.abigail@alexandra.delanet.com>
Lance Stevenson (zzredrumxx@aol.comNoSpam) wrote on MMCLXVII September
MCMXCIII in <URL:news:19990807185552.25923.00009151@ng-cn1.aol.com>:
==
== What kind of date are you loooking for?
==
== White [ ]
== Black [ ]
== Indonesian [ ]
== Spanish [ ]
== South Polish [ ]
No cucumber?
Abigail
--
perl -e '* * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * * *
/ / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / / /
% % % % % % % % % % % % % % % % % % % % % % % % % % % % % % % %;
BEGIN {% % = ($ _ = " " => print "Just Another Perl Hacker\n")}'
-----------== Posted via Newsfeeds.Com, Uncensored Usenet News ==----------
http://www.newsfeeds.com The Largest Usenet Servers in the World!
------== Over 73,000 Newsgroups - Including Dedicated Binaries Servers ==-----
------------------------------
Date: 7 Aug 1999 23:49:55 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: Fork question: running for a short amount of time and killing
Message-Id: <7oign3$iag$1@lublin.zrz.tu-berlin.de>
<rampage@dopeman.com> wrote in comp.lang.perl.misc:
>Here is the goal I'm trying to accomplish:
>
>I have a program which does an ssh into several machines to get log data to
>make sure some processes are doing what they should. As a extra backup I want
>the program to log into a machine, truss a defined process for n seconds, then
>kill the truss. Are there any examples for doing code like this? Here is what
>I tried:
>
>foreach $gPid (@epgPid) {
> ($junk, $lPid, $othercrap) = split(/\s+/, $gPid);
> print "\t* 10 second output from pid: $lPid\n";
> # This is where we fork a process for 10 seconds and show the
> # output. Right now this doesn't work. :)
> $pid = fork();
> die "Can't fork $!\n" unless defined $pid;
> if($pid) {
This code is executed in the parent process. Is that what you want?
> $SIG{CHLD} = sub {wait};
> system("ssh -q -l root $mach \"truss -p $lPid\"");
> }
The following is executed by both the parent and the child. This is
probably not what you want.
> sleep 10;
> kill 2, $pid;
>}
>
>That didn't work entirely - it ran the process and killed but on the other end
>I have to kill it manually on the server.
system() does an implicit fork. So, if anything, you're killing the
process that forked off the ssh-command, not the process that runs it.
You probably want to use exec instead of system, but in the child,
not the parent.
In any case, what you seem to expect will only happen if ssh passes
signals to the remote process, and if signal 2 is the right kind of signal.
Anno
------------------------------
Date: Sat, 7 Aug 1999 16:53:36 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: How? CPAN PODs?
Message-Id: <MPG.121666db2e68337d98968e@nntp1.ba.best.com>
Jon Bell (jtbell@presby.edu) seems to say...
> perldoc Net::FTP
> perldoc Net::NNTP
>
> I expect the documentation is also available on the mother of all Perl Web
> sites, http://www.perl.com/ .
Hope I haven't had too many beers.
IS there a place that has the PODs for CPAN modules? I often would
like to read the documentation before downloading the entire module.
This 1200 baud modem is killing me.
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Sat, 07 Aug 1999 20:14:45 -0400
From: "Harlan Carvey, CISSP" <carvdawg@patriot.net>
Subject: Re: How?
Message-Id: <37ACCBF5.AA9504B0@patriot.net>
You are using win95...which version of Perl are you using? If you are
using
ActiveState's ActivePerl, which build are you using?
You can install the modules in question by using PPM
perl ppm.pl install libnet
Craig wrote:
> If I get the Perl modules Net::FTP & Net::NNTP, how can I use them in a
> script?
>
> Thnx.....
------------------------------
Date: Sat, 7 Aug 1999 16:23:05 -0700
From: moseley@best.com (Bill Moseley)
Subject: Re: Is this an appropreate use of -i switch?
Message-Id: <MPG.12165fb8b96245b098968d@nntp1.ba.best.com>
Always so helpful. Thanks, Tom.
Now...
Tom Phoenix (rootbeer@redcat.com) warns me about the -I magic:
> Yes, depending upon what you consider a pitfall. :-)
> Here's a program which may (or may not) answer your question.
No, as typically happens, it causes another question to be asked.
Ok, your example shows how you could end up with partially updated
files. Not good.
One solution would seem to be to wrap the while loop in an eval and
check $@. If $@ returns true then do something like put the file back
to the way it was by copying the .bak file over the source and making some
type of fuss in a log file.
Well, when trying this I get a permission denied error. Is that
because the while (<>) still has the file open for reading? (BTW I changed
your program to read another file instead of $0.)
If the error is because the file is still open, then how does one close
the magic <>?
#!/usr/bin/perl -w
use strict;
@ARGV = 'testfile';
$^I = '.bak';
eval {
while (<>) {
die "emergency exit" if $. > 3;
} continue {
print;
}
};
if ( $@ ) {
## close <> here somehow?
# put the file back the way it was.
print STDERR "Ouch processing $ARGV: $@. (fixing)\n";
rename( $ARGV, "${ARGV}.bad" ) || die "Can't rename $ARGV: $!";
rename( $ARGV . $^I, $ARGV ) || die "Can't rename ${ARGV}$^I: $!";;
}
--
Bill Moseley mailto:moseley@best.com
pls note the one line sig, not counting this one.
------------------------------
Date: Sun, 8 Aug 1999 01:04:36 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: just days away f7.8ez5.88ox
Message-Id: <Pine.HPP.3.95a.990808010244.19473A-100000@hpplus03.cern.ch>
On Sat, 7 Aug 1999, -=SteveH=- wrote:
> <!doctype html public "-//w3c//dtd html 4.0 transitional//en">
You're off topic for any of these groups, then.
[groups narrowed and f'ups set. Plonks at 100 paces...]
------------------------------
Date: Sun, 8 Aug 1999 11:08:31 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: lstat on a unicode file in NT?
Message-Id: <MPG.12178395a6b3fbc5989c01@news-server>
Tom Shou writes ..
>I'm trying to open a unicode file on an Windows NT4.0 system, but
>lstat (stat behaves the same way) doesn't seem to be able to examine
>the file. The following lines don't print out any values:
>
>($dev,$ino,$mode,$nlink) = lstat($_); # where $_ happens to be a unicode file
>print "lstat output:$dev,$ino,$mode,$nlink \n";
it's my guess that $_ doesn't contain what you think it does .. what
happens if you type in the filename of this unicode file directly ?
if you could show us the code including where the $_ is being set then
we'd have a better chance at steering you in the right direction
--
jason - elephant@squirrelgroup.com -
------------------------------
Date: 8 Aug 1999 01:03:13 GMT
From: gorilla@elaine.drink.com (Alan Barclay)
Subject: Re: MATCH CASES AND PRINT TO A FILE
Message-Id: <934077779.724861@elaine.drink.com>
In article <37AA6131.C7A7AD54@home.com>,
Rick Delaney <rick.delaney@home.com> wrote:
>[posted & mailed]
>
>David Cassell wrote:
>>
>> If you have Perl 5.005 you can write that as
>>
>> print OUTFILE if /expression/;
>
>I don't have access to it right now to confirm, but I'd be very
>surprised if that didn't work in Perl4. I've never had an older version
>but I'll bet it goes back even farther than that.
works fine in perl 1 patch level 10
------------------------------
Date: 08 Aug 1999 02:06:43 GMT
From: darstec@aol.com (Darrell Stec)
Subject: Re: Nastiness contrary to the spirit of perl?
Message-Id: <19990807220643.21497.00004326@ngol04.aol.com>
In article <slrn7qmkpn.9pa.fl_aggie@thepentagon.com>, fl_aggie@thepentagon.com
(I R A Darth Aggie) writes:
>
>On 06 Aug 1999 18:18:58 GMT, Darrell Stec <darstec@aol.com>, in
><19990806141858.22915.00003391@ngol05.aol.com> wrote:
>
>+ I don't think there were ever "real" standards on the Internet.
>
>Oh, yes there are. Speaking of which, as a matter of nettiquette,
>could you trim your line folding to about 72 or so characters? thanks.
No, I can't and neither can some 20 million or so members of AOL. Now if you
would like to talk to Steve Case about it..........
>
>+ The Internet is the story of those who had one thing in mind when
>+ they started it, tried to maintain that view, and watched it change by
>+ the participants who wanted to use it for their own purposes. Email
>+ was an example of that. Beyond the designer's imagination, the users
>+ started to send personal messages as well as the intended research
>+ information.
>
>Ummm...as far as I know, there was never an RFC concerning personal
>email communication...
I wasn't referring to standards such as RFC, NNTP and the like. I thought that
paragraph explained what I had in mind. According to the book, "Where Wizards
Stay Up Late", the original concept of the Internet {ARPAnet} never included
correspondence of a personal nature about everyday mundane life. But the
original five servers were being used that way regardless. And certainly
commercialization was never anticipated at its inception. Again according to
the book.
>
>+ Yes, there is a tremendous amount of free documentation written. But shear
>+ volume does not make it good,
>
>You're right. What makes it good is the relative completeness, and the
>fact that it is shipped with *every*decent*perl*distribution*!!!
>
>+ nor easy to navigate.
>
>There are tools for that...
Not good ones for all Operating Systems.
>
>+ The documentation is as
>+ easy to find something in as finding a particular sentence in a novel with
>+ titles such as chapter one, chapter two, chapter three, etc., {perlfaq1,
>+ perfaq2, perfaq3 or the equally descriptive perlapio, perldsc}.
>
>Please. Why don't you go and install perlindex:
Sorry, it didn't come with my distribution package. An Index usually comes
with all good books and manuals. It and the Table of Contents are the first
factors in determining a book's value before a book is read. Unless of course
one is of the opinion that it is the cover that holds that coveted position.
>
>NAME
> perlindex - index and query perl manual pages
>
>SYNOPSIS
> perlindex -index
>
> perlindex tell me where the flowers are
>
>
>DESCRIPTION
> "perlindex -index" generates an AnyDBM_File index which
> can be searched with free text queries "perlindex a
> verbose query".
>
> Each word of the query is searched in the index and a
> score is generated for each document containing it. Scores
> for all words are added and the documents with the highest
> score are printed. All words are stemed with Porters
> algorithm (see the Text::English manpage) before indexing
> and searching happens.
>
>+ Then perhaps these "very same people" who give the RTFM give this response
>+ because they WTFM and just like to see their name in print.
>
>Ocham's razor suggests otherwise...
Ocham's razor SHOULD suggest otherwise, but from remarks expressed on this
newsgroup by some, one could get the impression that these same people still
think that they can call new people stupid all the time and there will be no
backlash. One of the few places I've been to where someone could insult a
potential customer and seemingly get away with it, was NYC.
>
>+ I agree with you there. It would be exasperating for the authors to
>+ answer the same questions that are in their books, over and over
>+ again. After all those that wrote the books, did so for the money,
>
>Why those greedy bastards! I'm surprised they're not charging license
>fees on the software they give away! That's no way to run a railroad!
>They'll go broke, and without corporate sponsorship, perl will go the
>way of the dodo bird within a year...
The railroads ARE going broke, at least in the USA. That WAS no way to run
them. If they were as altruistic as you would like to imply, their books would
be on the Internet, ready to download, in toto. There is nothing wrong with
making a profit on the books, but when 90% of their responses are RTFM {which
contains mention of their books}, instead of helpful suggestions, or simply
being quiet, I think their motives can be suspect.
>
>Sheesh, many of them go so far as to put the code examples on-line,
>instead of making you buy the book and typing them in...
>
>+ not because they love teaching which involves explaining the answer
>+ over and over again in many parallel ways until the student
>+ understands it.
>
>Have you ever taught before?
Yes, and that is why I know the difference between a good teacher and a writer.
>
>+ Then don't steer them to the documentation. If they have it and still
>+ need to ask a question, then obviously that documentation is too
>+ cumbersome, or doesn't explain the answer in a way the questioner
>+ understands.
>
>Or perhaps they don't know how to post? I don't think I've seen anyone
>post like this and get flamed for it:
>
> I read the documentation, but I just don't get it.
>
>This type of person makes a good-faith effort to Get It. This is like
>the student who comes in and says "I was in your lecture, but I don't
>understand." Ignorance can be cured.
You assume they haven't read anything. Not every writer of an article to the
newsgroups is going to preface his question with "I've read all the
documentation and books in the world and I still don't understand abc and xyz".
To some potential posters that may make them feel that they would appear
stupid, before they even begin to ask to question. Who wants to admit that
they can't understand a manual, when so many others are on this newsgroup
almost bragging that they can understand the entire documentation as easily as
a child can understand the pictures on a cereal box?
>
>+ How do you know that they are ignoring the documentation instead of
>+ just not understanding it.
>
>Because they may make a reference to reading the docs and not understanding
>them...
You just said "I don't think I've seen anyone post like this and get flamed for
it:
I read the documentation, but I just don't get it." That refers to those
who obviously state that they read the documentation. I repeat, how do you
know that they are ignoring the documention instead of just not understanding
it. You are making a very large assumption here, just because they may not
mention that they tried to find something in the documentation or didn't
understand it.
>
>[examples of products]
>
>+ The first thing the owners of these products do, before they read the
>+ manual is to call the manufacturerer's toll free number, or the store
>+ where they purchased it from. You should try dealing with people that
>+ buy cash registers, if you think this newsgroup is bad.
>
>The difference between here and there is?
>
>HINT: They gave you money for a product and the promise of
>support. Compare and contrast what you gave to get perl.
It still makes no difference whether they paid for the product, or the product
is a free newsgroup. Nastiness is still nastiness. And if one can't be nice,
they can just shut up and be quiet. As had been pointed out in this thread,
these RTFM people do not have to answer any questions, there are thousands of
lurkers here that can answer the questions in their stead.
>
>+ Perl like the C language...IMO they are two of the more inane because
>+ of their cryptic, terse style.
>
>Only if you're an undisciplined programmer. A good, disciplined
>programmer writes good, almost self-documenting code in any language.
>
Are you saying that in code like:
T2:
MOV AX, TIMER_LOW
SUB AX, BX
CMP AX, DX
JL T2
it is difficult to understand that MOV means "MOVe", SUB means "SUBtract", CMP
means "CoMPare", and JL means "Jump if Less than". And that is so much more
difficult to understand with abbreviations so close to their real words, than
something as terse and cryptic like: if m/^\w+(?=\s+Nasty)/
Do you really think that it is easier to understand? That a beginner can pick
up right away that you want to "Match the first Word in the string", "Use a
look-ahead assertion to match One or More Whitespace characters", "and in
addition to the Whitespace character, make sure that the next column starts
with characters "Nasty" sequentially"? Which one of those abbreviations is
easier to understand for a beginner than the fact that MOV means "MOVe" in
assembly? OK, the "if" is a given. Or that the difference between the $` and
$' variables is so easy for a beginner to see. I typed them and I can barely
see what they are. Or even if he came across something hypothetical like
"\/VW". Is that easy to spot as a "\" and a "/" and a "V" and a "W"?
>+ Some else will answer those questions in your stead.
>
>Which is worse: RTFM and come back if you don't understand, or an
>answer that is incorrect?
You make a large assumption with that statement that the ONLY people who have a
corner on the market on the correct answers are those few regular participants
(some of whom wrote a few books) whose favorite phrase is RTFM. For each one
of them there are hundreds if not thousands of readers lurking in the
background who also will have the correct answer. So what is worse? The RTFM,
because there will always be someone lurking in the background with the correct
answer, if the nastiness-noise ratio dies down.
>in the CGI newsgroup (comp.infosystems.www.cgi,
>I think) today someone posted date code they said was Y2K safe, along
>the lines of
>
>(...$year...)=gmtime(time-$offset);
>
>if ($year==99) {
> $year="1999";
>}else{
> $year="20$year";
>}
>
>It is to say the least a most unique Y2K bug they've introduced. It is
>left to the reader to discover *why* that code is WRONG WRONG WRONG.
>
>James
And the only ones that would have been aware of that, are the blessed holy
order of the RTFMers? So THEY had to answer and no one else?
Later,
Darrell Stec E-Mail: DarStec@aol.com
Webpage Sorcery
http://webpagesorcery.com
We Put the Magic in Your Webpages
------------------------------
Date: Sun, 08 Aug 1999 02:05:03 GMT
From: Jordan DeLozier <master@openendon.com>
Subject: Need Help - Connecting to HTTP
Message-Id: <37ACE86E.1E74E93E@openendon.com>
--------------DF40F58DDF8C003CA138B588
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Hello,
How could I make a script connect to a site and see if a file is
there or a 404 error? I understand how to use IO::Socket and have made a
mini-spider that retrieves Meta Tags, but is a very slow process and
doesn't detect 404 errors or any erros. I don't want to use LWP modules
though. Can anyone offer me any help at all?
Thanks for all of your help,
Jordan DeLozier
--
*************************
Openendon Top Sites
http://www.openendon.com
Top Sites Listing
*************************
--------------DF40F58DDF8C003CA138B588
Content-Type: text/html; charset=us-ascii
Content-Transfer-Encoding: 7bit
<!doctype html public "-//w3c//dtd html 4.0 transitional//en">
<html>
Hello,
<br> How could I make a script
connect to a site and see if a file is there or a 404 error? I understand
how to use IO::Socket and have made a mini-spider that retrieves Meta Tags,
but is a very slow process and doesn't detect 404 errors or any erros.
I don't want to use LWP modules though. Can anyone offer me any help at
all?
<p>Thanks for all of your help,
<br>Jordan DeLozier
<pre>--
*************************
Openendon Top Sites
<A HREF="http://www.openendon.com">http://www.openendon.com</A>
Top Sites Listing
*************************</pre>
</html>
--------------DF40F58DDF8C003CA138B588--
------------------------------
Date: Sun, 8 Aug 1999 01:59:11 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: Newbie question about $_
Message-Id: <pM3r3.391$FX2.3255@news1.online.no>
Abigail <abigail@delanet.com> wrote in message
news:slrn7qpa7h.1dr.abigail@alexandra.delanet.com...
> Trond Michelsen (mike@crusaders.no) wrote on MMCLXVII September MCMXCIII
> ~~ - It's 160 miles to Chicago, we have a full tank of gas and half a pack
of
> ~~ sigarettes. It's dark and we're wearing sunglasses.
> ~~ - Hit it!
> ~~ The one and sequel-less Blues Brothers
> Ah, but what about Blues Brothers 2000 then?
You know, I thought I saw this movie in a theatre a few years ago, but then
I realized it was only a bad dream. BB2000 really does not exist. It's just
an urban legend. Nobody ever made a sequel to the Blues Brothers.
--
Trond Michelsen
------------------------------
Date: Sat, 7 Aug 1999 17:35:16 -0700
From: lr@hpl.hp.com (Larry Rosler)
Subject: Re: Nicer Way
Message-Id: <MPG.1216709befc5b9e2989e02@nntp.hpl.hp.com>
In article <slrn7qpc43.1dr.abigail@alexandra.delanet.com> on 7 Aug 1999
17:17:53 -0500, Abigail <abigail@delanet.com> says...
> Larry Rosler (lr@hpl.hp.com) wrote on MMCLXVII September MCMXCIII in
> <URL:news:MPG.121600294528cf0a989dff@nntp.hpl.hp.com>:
> ??
> ?? #!/usr/local/bin/perl -w
> ?? use strict;
> ??
> ?? my $chmod = 'rwxr-xr-x';
> ?? ($_ = $chmod) =~ tr/rwx-/4210/;
> ?? $chmod = '';
> ?? $chmod .= $1 + $2 + $3 while /(.)(.)(.)/g;
> ?? print "$chmod\n";
> ?? __END__
>
> And if you want to frot the transformation in one statement:
>
> $chmod = join "" => map {eval join "+" => split //}
> grep {length} split /(...)/ => do {$str =~ y.rwx-.4210.; $str};
'frot' indeed. What language is that supposed to be? But the code
certainly looks frotty for sure.
Needless to say, I tried to do it in one statement (a 'one-liner', so to
speak) starting with 'join "" =>' of course, but failed. Undoubtedly
that's because 'eval' in this situation never occurred to me, and now
that you have forced it into my consciousness, I wish it would go away!
The original poster said 'nicer', which I doubt includes 'much, much
slower'. :-)
--
(Just Another Larry) Rosler
Hewlett-Packard Laboratories
http://www.hpl.hp.com/personal/Larry_Rosler/
lr@hpl.hp.com
------------------------------
Date: Sun, 8 Aug 1999 01:14:11 +0200
From: "Alan J. Flavell" <flavell@mail.cern.ch>
Subject: Re: object state maintained with Cookies? Is this possible?
Message-Id: <Pine.HPP.3.95a.990808010857.19473B-100000@hpplus03.cern.ch>
On Sat, 7 Aug 1999, J Gilbert wrote:
> I was wondering is it possible to use cookies to keep object persistance
> going as users go through our website?
Cookies were designed for maintaining state (persistence, as it says in
my dictionary). They can be turned off by readers who want to avoid
maintaing state. Perhaps if you were to reveal to the group a little
more about what you are trying to achieve, in real world terms?
> Thanks in advance for time,
All the evidence seems to suggest that time was there before we were,
although this may of course just be a massive fraud by the creator.
Or white mice, on another theory.
Thanking us for it seems a bit, well, off-topic, hmmm?
> PS. We like to avoid writing files to our system to maintain state.
You prefer writing them to your readers' systems? No wonder they are
tempted to turn cookies off.
I'm sorry; what was your question, really?
--
"I have no problem with cute and clever. In fact I actually _like_ cute
and clever. I don't think it's clever to be cute in such a way as to
make the pages less useful. But then I'm not a graphic designer."
- Calum I Mac Leod on c.i.w.a.site-design
------------------------------
Date: 7 Aug 1999 23:24:11 GMT
From: michael@merlin.spconnect.com (Michael Ghens)
Subject: Precompliled perl5.005 for sun4
Message-Id: <slrn7qpg0l.hab.michael@merlin.spconnect.com>
Subject says it all. Looking for a precompiled version of perl5.005 for
sun4.1.4
------------------------------
Date: 7 Aug 1999 18:07:57 -0700
From: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: rows to columns
Message-Id: <37acca5d@cs.colorado.edu>
[courtesy cc of this posting mailed to cited author]
In comp.lang.perl.misc,
eric@fruitcom.com writes:
:I have been uable to iterate through this file and convert the following
:structure:
:
:chair,hair,person,ball
:table,nose,man,bat
:floor,mouth,woman,wicket
:
:to this:
:
:chair,table,floor
:hair,nose,mouth
:person,man,woman
:ball,bat,wicket
:
:The obvious thing for me was to use an iterator with its range set to the
:number of elements in the line. So I planned to loop through the lines
:with the iterator set to `0' and then up to (in this case) `3'. But the
:problem I could not solve with this for loop:
: for ($i=0;$i<$#arry;$i++)
:was that the iteration progresses from 0 to $# on each line. So it does the
:iteration on each line insted of doing the full loop and _then_ an iteration.
:
:What is a way to do this transformation?
Simple -- it's a row-column interchange. Just do
$matrix2[$column][$row] = $matrix1[$row][$column]
for each row and each column.
while (<DATA>) {
chomp;
$m1[$. - 1] = [ split /,/ ]
}
for ($i = 0; $i < @m1; $i++) {
for ($j = 0; $j < @{ $m1[0] }; $j++) {
$m2[$j][$i] = $m1[$i][$j];
}
}
for $rowptr (@m2) {
print join(q/,/ => @$rowptr), "\n";
}
__END__
chair,hair,person,ball
table,nose,man,bat
floor,mouth,woman,wicket
Will produce:
chair,table,floor
hair,nose,mouth
person,man,woman
ball,bat,wicket
Per your request.
Also you might care to think about this from the Perl Cookbook:
=head2 Description
Have you ever wondered how programs like I<ls> generate columns
of sorted output that you read down the columns instead of across
the rows? For example:
awk cp ed login mount rmdir sum
basename csh egrep ls mt sed sync
cat date fgrep mail mv sh tar
chgrp dd grep mkdir ps sort touch
chmod df kill mknod pwd stty vi
chown echo ln more rm su
Here's code that does that:
#!/usr/bin/perl -w
# words - gather lines, present in columns
use strict;
my ($item, $cols, $rows, $maxlen);
my ($xpixel, $ypixel, $mask, @data);
getwinsize();
# first gather up every line of input,
# remembering the longest line length seen
$maxlen = 1;
while (<>) {
my $mylen;
s/\s+$//;
$maxlen = $mylen if (($mylen = length) > $maxlen);
push(@data, $_);
}
$maxlen += 1; # to make extra space
# determine boundaries of screen
$cols = int($cols / $maxlen) || 1;
$rows = int(($#data+$cols) / $cols);
# pre-create mask for faster computation
$mask = sprintf("%%-%ds ", $maxlen-1);
# subroutine to check whether at last item on line
sub EOL { ($item+1) % $cols == 0 }
# now process each item, picking out proper piece for this position
for ($item = 0; $item < $rows * $cols; $item++) {
my $target = ($item % $cols) * $rows + int($item/$cols);
my $piece = sprintf($mask, $target < @data ? $data[$target] : "");
$piece =~ s/\s+$// if EOL(); # don't blank-pad to EOL
print $piece;
print "\n" if EOL();
}
# finish up if needed
print "\n" if EOL();
# not portable -- linux only
sub getwinsize {
my $winsize = "\0" x 8;
my $TIOCGWINSZ = 0x40087468;
if (ioctl(STDOUT, $TIOCGWINSZ, $winsize)) {
($rows, $cols, $xpixel, $ypixel) = unpack('S4', $winsize);
} else {
$cols = 80;
}
}
The most obvious way to print out a sorted list in columns is to
print each element of the list, one at a time, padded out to a
particular width. When you're about to hit the end of the line,
generate a newline. But that only works if you're planning on
reading each row left to right. If you instead expect to read it
down each column, this approach won't do.
The I<words> program above is a filter that generates output that
can be down the columns. The way it does this is to first read all
input, keeping track of the longest line seen. When everything has
been read in, it divides the screen width by the longest input record
seen, yielding the expected number of columns.
Then the program goes into a loop that executes once per input record.
But the output order isn't in the obvious order. Imagine you had
a list of nine items.
Wrong Right
----- -----
1 2 3 1 4 7
4 5 6 2 5 8
7 8 9 3 6 9
The I<words> program does the necessary calculations to print
out elements C<(1,4,7)> on one line, C<(2,5,8)> on the last, then
C<(3,6,9)> on the last.
To figure out the current window size, this program calls a quick
and dirty C<ioctl> call. This works fine--on the system it was
written for. On anything other system, it won't work. If that's
good enough for you, than good for you. The recipe ``Using h2ph to
Translate C #include Files'' shows how to find this on your system
using the I<ioctl.ph> file, or with a C program. A more portable
solution can be found in ``Determining Terminal or Window Size'',
but that requires installing a CPAN module.
--tom
--
"A ship then new they built for him/of mithril and of elven glass"
--Larry Wall in perl.c from the v5.0 perl distribution,
citing Bilbo from Tolkien's Lord of the Rings trilogy
------------------------------
Date: 8 Aug 1999 01:37:16 -0000
From: anno4000@lublin.zrz.tu-berlin.de (Anno Siegel)
Subject: Re: rows to columns
Message-Id: <7oin0c$ilk$1@lublin.zrz.tu-berlin.de>
Eric Smith <eric@fruitcom.com> wrote in comp.lang.perl.misc:
>
>Hi there
>
>I have been uable to iterate through this file and convert the following
>structure:
>
>chair,hair,person,ball
>table,nose,man,bat
>floor,mouth,woman,wicket
>
>to this:
>
>chair,table,floor
>hair,nose,mouth
>person,man,woman
>ball,bat,wicket
>
>The obvious thing for me was to use an iterator with its range set to the
>number of elements in the line. So I planned to loop through the lines
>with the iterator set to `0' and then up to (in this case) `3'. But the
>problem I could not solve with this for loop:
> for ($i=0;$i<$#arry;$i++)
>was that the iteration progresses from 0 to $# on each line. So it does the
>iteration on each line insted of doing the full loop and _then_ an iteration.
>
>What is a way to do this transformation?
Nesting two loops. Suppose you have your lines in an array of array refs,
such as
my @lines = ( [ 11, 12, 13 ], [ 21, 22, 23 ] );
and want to build a similar structure
my @cols;
A very straightforward way to do this is to
for ( my $i = 0; $i < @lines; $i++ ) { # loop over lines
for ( my $k = 0; $k < @{ $lines[ 0]}; $k++ ) { # loop over columns
$cols[ $k][ $i] = $lines[ $i][ $k]; # note how $i and $k swap positions
}
}
If you want it on a single line,
push @cols, [ map shift( @$_), @lines ] while @{ $lines[ 0]};
does the same. This one destroys the input array, and you lose
some perspicu... wossname, ease of seeing what it does. It's
also slower. But very Perlish, no?
Anno
------------------------------
Date: Sun, 08 Aug 1999 02:15:31 GMT
From: mdkail@connectnet.com (Mike D. Kail)
Subject: Re: smrsh and Perl Script: unknown mailer error 13
Message-Id: <slrn7qpq31.goi.mdkail@cn1.connectnet.com>
On Fri, 06 Aug 1999 07:51:31 -0700, Bruce Mohler
<bruce.w.mohler@cpmx.saic.com> wrote:
>
>
>I'm running Red Hat Linux 6.0 which seems to be running sendmail
>v8.9.3 which was built with support for smrsh.
>
>I need to have an account receive e-mail and pipe it to a Perl
>script for processing. This worked fine on a RH Linux 5.1
>system which was not configured for smrsh.
>
>The .forward file in the account's home directory looks like this:
>
> |/home/xyz/incoming.pl
>
>The permissions on the .forward file are 0600.
>
>The script resides in the home directory of account "xyz" with
>permissions 0755.
>
>The smrsh binary directory is /etc/smrsh and there is a symbolic
>from the /etc/smrsh directory to the Perl script in the account's
>home directory.
>
> ln -s /home/xyz/incoming.pl /etc/smrsh/incoming.pl
>
>Each time that I send e-mail to the "xyz" account on the system,
>the maillog reports "unknown mailer error 13".
>
>I did restart sendmail after creating the link in /etc/smrsh.
you also need a symlink to the 'perl' binary.
/mdkail
------------------------------
Date: Sun, 8 Aug 1999 11:00:21 +1000
From: elephant@squirrelgroup.com (elephant)
Subject: Re: System call in Win NT, AS Build 518
Message-Id: <MPG.121781ae264ec5ce989c00@news-server>
Tamim Hofioni writes ..
>About a year ago I wrote a simple perl script on a windoze NT box using
>ActiveState's Build 502 that had the following line in it:
>
>system("write.exe $text_file");
>
>This would start up WordPad in Windoze and open the text file for the
>user to view.
you'll find this discussed recently in this newsgroup .. I believe that
people were discussing the opening of a calc.exe window - you may want to
search on calc.exe for the thread
--
jason - elephant@squirrelgroup.com -
------------------------------
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 417
*************************************