[13725] in Perl-Users-Digest
Perl-Users Digest, Issue: 1135 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Wed Oct 20 17:10:40 1999
Date: Wed, 20 Oct 1999 14:10:25 -0700 (PDT)
From: Perl-Users Digest <Perl-Users-Request@ruby.OCE.ORST.EDU>
To: Perl-Users@ruby.OCE.ORST.EDU (Perl-Users Digest)
Message-Id: <940453825-v9-i1135@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Wed, 20 Oct 1999 Volume: 9 Number: 1135
Today's topics:
Re: SGML/HTML parsing tool (Jon Drukman)
Re: stealing the news: how hard can it be? (Randal L. Schwartz)
Re: Substitution (Craig Berry)
Re: Substitution (Peter J. Kernan)
Re: Substitution (Neko)
Re: Substitution <gellyfish@gellyfish.com>
Re: this darn error <makkulka@cisco.com>
threads package makky@my-deja.com
Re: threads package (Brett W. McCoy)
Re: Trimming down file names for all files in dir <makkulka@cisco.com>
Re: Unix command ´tree´ in Perl? (Scott McMahan)
Re: upload file help <makkulka@cisco.com>
url not responding <hxshxs@my-deja.com>
Re: url_param issue <gellyfish@gellyfish.com>
use 'use' and 'no' like pragmas?? <jtolley@bellatlantic.net>
Re: what is SHTML ? (Craig Berry)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Wed, 20 Oct 1999 19:48:45 GMT
From: jsd@hudsucker.gamespot.com (Jon Drukman)
Subject: Re: SGML/HTML parsing tool
Message-Id: <slrn80s74v.1vh5.jsd@hudsucker.gamespot.com>
In article <slrn80rejk.fji.abigail@alexandra.delanet.com>, Abigail wrote:
>Christopher R. Maden (crism@exemplary.net) wrote on MMCCXLI September
>MCMXCIII in <URL:news:crism-2010990243160001@pm3b-12.meer.net>:
>;; Have you tried HTML::Parser for parsing HTML?
>Yes, I have. It's about as useful for parsing HTML as a table is
>to do shopping with.
>HTML::Parser doesn't parse, nor does it have any HTML knowledge.
i'd hate to see the pathological cases you must have to deal with.
i've been using HTML::Parser in dozens of scripts and it hasn't
coughed up a hairball yet. it has tackled hand generated code, as
well as crap from frontpage and dreamweaver with aplomb.
then again your definition of "parsing" may well be different from mine.
--
Jon Drukman
Director of Technology
GameSpot
------------------------------
Date: 20 Oct 1999 12:51:39 -0700
From: merlyn@stonehenge.com (Randal L. Schwartz)
Subject: Re: stealing the news: how hard can it be?
Message-Id: <m1n1tdlsj8.fsf@halfdome.holdit.com>
>>>>> "TechGuy" == TechGuy <michael@cermak.com> writes:
TechGuy> I'd like to find/modify a script to seek out current
TechGuy> headlines (such as Yahoo! news, CNET, CNN, or anything like
TechGuy> that) and create a small list (maybe half a dozen) links on a
TechGuy> page to those articles. I suppose this would be somewhat
TechGuy> similar to the services offered by isyndicate.com. Any
TechGuy> suggestions, comments, ideas, urls, etc are greatly
TechGuy> appreciated.
If they are providing news in RSS format, you can use the XML::RSS
module in the CPAN to parse the file. Many big news services are,
including <URL:www.news.perl.org>.
And it's funny you should bring that up, because my next WebTechniques
column is precisely that. Well, it pulls up a list of news services,
gets the headlines, and then sends mail of only the new headlines.
That'll show up in the Jan'00 issue of WT, and on the web shortly
after that. Past columns are at:
http://www.stonehenge.com/merlyn/WebTechniques/
so watch this area in a few months.
print "Just another Perl hacker,"
--
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!
------------------------------
Date: Wed, 20 Oct 1999 20:14:42 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: Substitution
Message-Id: <s0s8lirrr0154@corp.supernews.com>
Randal L. Schwartz (merlyn@stonehenge.com) wrote:
: >>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
: Larry> Par, at best.
: Larry> s/\n/<p>/ for @plan;
: Larry> Eagle.
: Birdie. Eagle woudld have been:
:
: s/\n/<p>/g for @plan;
With trepidation, I correct Randal: The @plan array in the original post
was populated via list-context <> with $/ set to its default value. Thus,
each element of @plan can have at most one \n, and that at the very end.
A global match is superfluous in this case.
Indeed, for a well-formed text file, there *must* be exactly one at the
end of each element. You could rewrite the above loop as
substr($_, -1) = '<p>' for @plan;
without change in behavior, given the well-formed text file constraint
(though of course it sucks in golf terms).
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
Date: 20 Oct 1999 20:55:10 GMT
From: pete@theory2.phys.cwru.edu (Peter J. Kernan)
Subject: Re: Substitution
Message-Id: <slrn80sb1e.di2.pete@theory2.phys.cwru.edu>
On 20 Oct 1999 11:33:55 -0700, Randal L. Schwartz <merlyn@stonehenge.com> wrote:
.=Larry> s/\n/<p>/ for @plan;
.=
.=Larry> Eagle.
.=
.=Birdie. Eagle woudld have been:
.=
.= s/\n/<p>/g for @plan;
though that would be better some of the time, we had
@plan = <PLAN>;
no g needed here.
--
Pete
------------------------------
Date: Wed, 20 Oct 1999 13:59:47 -0700
From: tgy@chocobo.org (Neko)
Subject: Re: Substitution
Message-Id: <7ywOOIyXJcROAY9VzBI40kElNhNc@4ax.com>
On 20 Oct 1999 11:33:55 -0700, merlyn@stonehenge.com (Randal L. Schwartz)
wrote:
>>>>>> "Larry" == Larry Rosler <lr@hpl.hp.com> writes:
>
>Larry> Par, at best.
>
>Larry> s/\n/<p>/ for @plan;
>
>Larry> Eagle.
>
>Birdie. Eagle woudld have been:
>
> s/\n/<p>/g for @plan;
Is the /g modifier necessary?
s/
/<p>/ for @plan;
--
Neko | tgy@chocobo.org | Will hack Perl for a moogle stuffy! =^.^=
------------------------------
Date: 20 Oct 1999 20:25:13 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: Substitution
Message-Id: <7ul8f9$afh$1@gellyfish.btinternet.com>
On 20 Oct 1999 11:55:59 GMT oliver.cookYTTFIT@ukonline.co.uk wrote:
>
> I'm having trouble with substitution. What I am trying to do, is write
> a perl script that will prepare my .plan file for display on the web.
> That means changing \n for <p> and changing *text* to <b>text</b>.
>
> I wrote this script, but it bombs with the error "Can't modify array
> deref in substitution at /usr/local/apache/cgi-bin/plan.pl line 6,
> near "s/\n/\<p\>/;""
>
> The script is:
>
> #!/usr/bin/perl
> print "content-type:text/html\n\n";
> open (PLAN, "/home/ollie/.plan") || die "could not open plan file";
>
> @plan = <PLAN>;
> close(PLAN)||die "could not close plan file";
> @plan =~ s/\n/\<p\>/;
> print @plan;
>
> Any help on this one would be very gratefully received.
>
*I* would would get *really* lazy - after all golf is just a good walk
spoiled ... :
print "<PRE>\n",<PLAN>,"</PRE>\n";
;-}
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 20 Oct 1999 12:57:30 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: this darn error
Message-Id: <380E1EAA.D4942C5C@cisco.com>
Mikee wrote:
> every time i try to run a .pl file i get this error
> <offline mode> : entername=value pairs on standard input
This is not an error.
Your script is using cgi.pm module.
If your script is run on command line it waits
or you to enter the name/value pairs
--
------------------------------
Date: Wed, 20 Oct 1999 19:00:49 GMT
From: makky@my-deja.com
Subject: threads package
Message-Id: <7ul3gp$j2u$1@nnrp1.deja.com>
Hi, does someone know if there is a user-level threads package such as
pthreads for perl. Thanks.
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: Wed, 20 Oct 1999 19:27:53 GMT
From: bmccoy@foiservices.com (Brett W. McCoy)
Subject: Re: threads package
Message-Id: <slrn80s66a.gep.bmccoy@moebius.foiservices.com>
Also Sprach makky@my-deja.com <makky@my-deja.com>:
>Hi, does someone know if there is a user-level threads package such as
>pthreads for perl. Thanks.
The latest stable version (5.005_03) of Perl supports threads now, via a
Thread module. Check it out!
--
Brett W. McCoy bmccoy@foiservices.com
Computer Operations Manager (Alpha Geek) http://www.foiservices.com
FOI Services, Inc./DIOGENES 301-975-0110
---------------------------------------------------------------------------
------------------------------
Date: Wed, 20 Oct 1999 12:50:25 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: Trimming down file names for all files in dir
Message-Id: <380E1D00.5B381E3E@cisco.com>
Dutch McElvy wrote:
> Each file has the same naming convention and character count but the actual
> file names are unknown.
If each name is of constant length and you want to extract parts of
it then use substr ()
> example file: /(.....)(...)(......)(....)/
If you know what goes between ( and ) then you can use a re
--
------------------------------
Date: Wed, 20 Oct 1999 19:45:03 GMT
From: scott@aravis.softbase.com (Scott McMahan)
Subject: Re: Unix command ´tree´ in Perl?
Message-Id: <3ZoP3.1781$hK6.96817@monger.newsread.com>
Daniel Apolinario (970493@dcc.unicamp.br) wrote:
> I would like to know if anybody knows how to implement the unix
> command ´tree´ in PERL language.
This is an odd request, becuase when I run this command, I get:
tree: Command not found.
I have used many flavors of UNIX through the years and have never
encountered this command.
There is an old DOS command called "tree" -- is that what you mean? Create
a Perl implementation of the DOS command tree that will run on UNIX?
Scott
PS: If so, I suggest you buy my book. For that matter, even if not I
suggest you buy my book :) Everyone should own two copies :) I have
a sample application that traverses the directory tree two different
ways. It doesn't print the tree, but a little hacking will fix that.
One way uses old-fashioned directory traversal, and the other
File::Find.
http://autoperl.skwc.com Automating Windows With Perl
------------------------------
Date: Wed, 20 Oct 1999 12:54:47 -0700
From: Makarand Kulkarni <makkulka@cisco.com>
Subject: Re: upload file help
Message-Id: <380E1E07.C6B74763@cisco.com>
Timothy Martin wrote:
> Is it possible to upload a file from an html form using cgi?
yes
> I know what
> to do on the html side to get an upload form box, what do I need to write
> in the cgi? Right now I can get the name of the file, but can't retrieve
> the actual file.
study this example ( upload.pl ) on this page
http://www.wiley.com/compbooks/stein/source.html
That should help u.
--
------------------------------
Date: Wed, 20 Oct 1999 20:39:00 GMT
From: Howard <hxshxs@my-deja.com>
Subject: url not responding
Message-Id: <7ul992$nhc$1@nnrp1.deja.com>
Hi, I am using LWP::Simple; @page=get($url) to retrieve html. I wonder
how to "try and catch" in Perl if the URL is not responding?
Thanks.
Howard
Sent via Deja.com http://www.deja.com/
Before you buy.
------------------------------
Date: 20 Oct 1999 20:53:39 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: url_param issue
Message-Id: <7ula4j$agd$1@gellyfish.btinternet.com>
On 19 Oct 1999 12:21:43 PDT Brian A. Bard wrote:
> url_param() works fine on my NT 4.0 PWS machine but when the script goes up
> to my Concentric Host Unix server it fails: Software error: Undefined
> subroutine &main::url_param called at /cgi/prodpgs.cgi line 34.
>
> Of couse I've got: use CGI qw/:standard/;
> and other functions from there work?
>
Well I dont know waht to say - I guess you must have a different version
of CGI.pm on the Unix host because - version I have of CGI.pm (2.42)
exports it as part of the :cgi tokens which in turn is part of :standard.
I'd check the respective versions ...
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Wed, 20 Oct 1999 19:42:25 GMT
From: James Tolley <jtolley@bellatlantic.net>
Subject: use 'use' and 'no' like pragmas??
Message-Id: <380E1AC5.7DDEC846@bellatlantic.net>
Hello all,
I am writing a module which ties STDOUT when you 'use Module;'.
I'm hoping that there's a way to (temporarily (and locally, if
possible)) untie STDOUT with a simple 'no Module;' - similar to turning
on and off strict with a "no strict 'refs'".
I think not. unimport() gets called as if the 'no' is in a BEGIN
block... but maybe someone has a suggestion?
tia,
James
------------------------------
Date: Wed, 20 Oct 1999 20:03:46 GMT
From: cberry@cinenet.net (Craig Berry)
Subject: Re: what is SHTML ?
Message-Id: <s0s812jvr0183@corp.supernews.com>
Ed Toivanen (et@telus.net) wrote:
: Martien Verbruggen <mgjv@wobbie.heliotrope.home> wrote in message
: news:slrn80ogcj.1vv.mgjv@wobbie.heliotrope.home...
[funny stuff snipped]
: Why is it ok for you to post off topic, then?
Because he tipped the maitre'd, of course.
--
| Craig Berry - cberry@cinenet.net
--*-- http://www.cinenet.net/users/cberry/home.html
| "They do not preach that their God will rouse them
a little before the nuts work loose." - Kipling
------------------------------
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 1135
**************************************