[13505] in Perl-Users-Digest
Perl-Users Digest, Issue: 915 Volume: 9
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Sun Sep 26 18:07:22 1999
Date: Sun, 26 Sep 1999 15:05:11 -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: <938383510-v9-i915@ruby.oce.orst.edu>
Content-Type: text
Perl-Users Digest Sun, 26 Sep 1999 Volume: 9 Number: 915
Today's topics:
Re: **Perl tutorials!** <cassell@mail.cor.epa.gov>
<-- The code is about reading file and $ENV <rusenet@bigfoot.com>
Re: Accessing Browser History <cassell@mail.cor.epa.gov>
Re: awesome perl/CGI sites (Kragen Sitaker)
Re: CGI sending email with attachment <zengzr@usa.net>
Re: CGI sending email with attachment <cassell@mail.cor.epa.gov>
how to "use" my variables in modules (Jeff Greer)
Re: injecting "my" varibales into caller's scope <gellyfish@gellyfish.com>
Re: memory use of children (Ilya Zakharevich)
Re: memory use of children (Kragen Sitaker)
Re: Need a unique "ID" string <rusenet@bigfoot.com>
Re: Need a unique "ID" string <revjack@radix.net>
Re: Randomize array..... (Abigail)
Re: Randomize array..... (Kragen Sitaker)
Re: remove the html tag in the file <skilchen@swissonline.ch>
Re: remove the html tag in the file (Abigail)
Re: remove the html tag in the file <gellyfish@gellyfish.com>
Trouble with CPAN module <ask_for_my_address_if_you_need_it@earthlink.net>
Where did comp.lang.perl go? <rusenet@bigfoot.com>
Re: Where did comp.lang.perl go? <meowing@banet.net>
Re: Where did comp.lang.perl go? <rusenet@bigfoot.com>
Re: Where did comp.lang.perl go? (Abigail)
Re: where to write perl??? <mike@crusaders.no>
Re: Which are the best books for learning Perl for use <camerond@mail.uca.edu>
Why does my code NOT work? <rusenet@bigfoot.com>
Re: You should be admired, or What does this have to do <dwoods@ucalgary.ca>
Re: You should be admired (Michel Dalle)
Digest Administrivia (Last modified: 16 Sep 99) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: Sun, 26 Sep 1999 15:03:55 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: **Perl tutorials!**
Message-Id: <37EE984B.A59B3462@mail.cor.epa.gov>
IlIIIIIIII wrote:
>
> I found a bunch at http://devlibrary.tsx.org/ !
Well, if it isn't our ol' pal IlIIIIIIII drumming up more fake
hype for his site. Let's see. He hasn't pestered this NG with
this very same line for more than a month now, has he?
And he still doesn't seem to know that Perl isn't just for CGI.
Uurgh.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 26 Sep 1999 23:15:04 +0200
From: "Rik." <rusenet@bigfoot.com>
Subject: <-- The code is about reading file and $ENV
Message-Id: <7sm2jk$52b$1@voyager.cistron.net>
------------------------------
Date: Sun, 26 Sep 1999 15:05:18 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: Accessing Browser History
Message-Id: <37EE989E.D7B71166@mail.cor.epa.gov>
SteveT wrote:
>
> Is there a way to access the browser's history using PERL?
Well, using Perl [not PERL] you could do this pretty easily
using the module Netscape::History or the module
Netscape::HistoryURL . Both come with docs which have
examples.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 26 Sep 1999 21:36:28 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: awesome perl/CGI sites
Message-Id: <wlwH3.422$J66.71592@typ11.nn.bcandid.com>
Capsule summary: stay away from these guys, because they don't know
what they're talking about, and will direct you to some really bad code
that will let anyone break into your machine. Look at Randal's
WebTechniques column or something instead.
I review one of the scripts linked to and find it wanting.
In article <7slij4$qq2$1@nnrp1.deja.com>, <akashgoel@my-deja.com> wrote:
>The Links Archive is a site created and maintained by me. It contains a
>lot of links to various sites on the web including Perl/CGI.
Here's what "The Links Archive" has to say about "Perl/CGI":
- Cgi/Perl - CGI and Perl is a very useful language that can be
used by webmasters in many ways.
Uh-oh. They think "CGI and Perl" is a language. This is a tip-off,
folks: don't trust what they say.
They have six links in this category, reviewed with little
[star.gif]'s. (No ALT attributes.) The ratings range from 3 star.gifs
to 4.5 star.gifs.
It turns out they give Matt's Script Archive, the third of the six
links, a 4.
All of the links go through
"http://www.bannerexchanger.com/pkewl2002/cgi-bin/LinkTo.pl". So
evidently they're getting paid in some fashion for linking to these
other web pages. It also packages up the other people's linked-to web
sites in a frameset, the top frame of which links back to "The Links
Archive", and conveniently hides the URL of the web page you're
visiting.
The first link is to "The CGI Resource Index", rated 4.5 star.gifs, at
www.cgi-resources.com. This is a site with apparently more than 2000
CGI scripts. They have a nifty little rating system with which
users vote on which scripts they like best.
The #1 rated script on the site is "Lozinski's Emailer", at
http://users.erols.com/lozinski/scripts/email.html, which displays an
HTML form for sending email. Here are some excerpts:
#!/usr/bin/perl
. . .
#http://www.domain.com/cgi-bin/email.pl?subject=Hi_there!
#
# Note the "?subject=" part at the end of the URL. This is required
#in order for the subject to be read. Note that you cannot have any
#spaces in the subject part of the URL. So, the following will not work:
# ?subject=Testing this script
. . .
#The title of the web page and the text on the "submit" button
my $TITLE = "Send Lozinski Email!";
. . . (It doesn't use strict, despite using mostly 'my' variables)
my $destination_email = "default_email\@your.domain.com";
. . .
sub print_header {
print ("Content-type: text/html\n\n");
print ("<HTML>\n<HEAD>\n");
print ("<TITLE>$TITLE</TITLE>\n");
print ("</HEAD>\n");
print ("<BODY BGCOLOR=\"$BGCOLOR\" BACKGROUND=\"$BACKGROUND_URL\" ");
print ("TEXT=\"$TEXT_COLOR_NORMAL\">\n");
}#print_header
. . . (note no indentation (despite the author's BS in CS), no here-
document, and backslashed quotes . . . although other parts of
the program use here-documents)
if ($request_method eq "GET") {
$form_info = $ENV{'QUERY_STRING'};
} else {
$size_of_form_information = $ENV{'CONTENT_LENGTH'};
read (STDIN, $form_info, $size_of_form_information);
}
. . . (so if someone sends a HEAD request, it will try to read the query
string from stdin)
. . . (get_form_data returns its results in a global variable called
%FORM_DATA. Here's how it handles multiple values:)
$FORM_DATA{$key} = join (", ", $FORM_DATA{$key}, $value);
. . . (here's how check_form_data looks up errors:)
my %error_codes = (
"1" => "You need to enter your email address.",
"2" => "Your message cannot be sent without a
subject.",
"3" => "You seemed to have forgotten to enter the
email message you wish to send.",
"4" => "For security reasons, you cannot have any of the
following characters in your email or subject fields: [ ; < > & \* ` \| ] "
);
. . . (check_form_data returns its result in a global numeric variable
called $error, whose meaning is looked up in the above table.
I'm not sure why the author does this; perhaps he doesn't know
about return or storing strings in scalar variables.)
. . . (Here's how the mail gets sent:)
open (MESSAGE, "|$sendmail -f $FORM_DATA{'users_email'} -t $destination_email "
);
. . . (Note that the author forgot to include ^ in the list of forbidden
characters, so anyone can run arbitrary commands on your machine as you,
or as www or nobody, depending on your setup, if you install this
script. Also forgot to include space, which means they can pass
whatever command-line arguments they want to sendmail. Also forgot
to include $, which means that if they want to, they can interpolate
arbitrary environment variables into their email address, and since they
also forgot to include (), if the script is run on a system where
/bin/sh supports the ksh $() syntax -- as bash does -- there's yet
another way to run arbitrary commands.)
***
So the top-rated script on the top-rated site of your list of links
- is evidently written by somebody who didn't know Perl or CGI very well,
- opens a security hole that allows anybody in the world to run
arbitrary commands on your system, a security hole apparently due to
the fact that the author
- did not read the manual page for sendmail to learn what the -t
option (which he was using!) actually did,
- didn't read the CGI security FAQ
(http://www.go2net.com/people/paulp/cgi-security/safe-cgi.txt),
which describes this exact bug, as well as how to fix it, even to
the point of including example Perl code you can "copy-paste".
- didn't read the WWW security FAQ by Lincoln Stein
(http://www.w3.org/Security/Faq/wwwsf4.html), which also describes
exactly the same bug, and also describes exactly how to avoid it.
- may have read the Perl CGI FAQ
(http://www.perl.com/CPAN/doc/FAQs/cgi/perl-cgi-faq.html), which
recommends just piping to sendmail without passing it addresses
on the command line, but implies that it is a reasonable
alternative to try to safely strip shell metacharacters
- creates non-RFC-822-compliant mail, because the author forgot the
blank line between the header and the body. (I didn't include this
part of the script in the excerpts above.)
So this is the best of the best of what you have to offer?
> We have a
>listing of a the best CGI/PERL websites available. Sites such as CGI
>Resources are some of the best websites if you are looking for
>tutorials on how to write Perl or if you want to copy-paste some cool
>codes.
Your definitions of "best" and "cool" are definitely different from mine.
Kragen
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 26 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 26 Sep 1999 16:28:13 +0800
From: "Zeng Zhaorong" <zengzr@usa.net>
Subject: Re: CGI sending email with attachment
Message-Id: <o2lks7.qca.ln@linux.asti-beijing>
Kragen Sitaker wrote in message ...
>
>Wow, wasn't I nasty. And I was wrong, too:
> The encapsulation boundary following the last body part is a
> distinguished delimiter that indicates that no further body parts
> will follow. Such a delimiter is identical to the previous
> delimiters, with the addition of two more hyphens at the end of the
> line:
>
>RFC 1521.
>
Well, actually, RFC 1521, 1522, etc. is obsoleted by RFC2045 - RFC2049
:-)
------------------------------
Date: Sun, 26 Sep 1999 15:00:34 -0700
From: David Cassell <cassell@mail.cor.epa.gov>
Subject: Re: CGI sending email with attachment
Message-Id: <37EE9782.EB77A976@mail.cor.epa.gov>
Earl Hood wrote:
>
> In article <37EBDF08.49A8E286@mail.cor.epa.gov>,
> David Cassell <cassell@mail.cor.epa.gov> wrote:
>
> >> You missed the '--' needed to tell it that's the last boundary. Not sure
> >> if it's strictly necessary but I always add it. You never know when you
>
> It is required.
Yes, but I didn't make that claim. The previous poster did.
> >> might want to toss the whole multipart into another multipart and I think
> >> it is essential then.
> >
> >That's feasible, and certainly legal according to the RFC. But
> >I would recommend avoiding shoving a multipart inside another
> >multipart. Many of the mail readers it has been my misfortune
> >to encounter will not handle this situation correctly.
>
> This is pathetic. I've had Perl code back in version 4 days that
> handled arbitrarily nested multipart messages, and we still have
> "modern" (PC) MUAs that cannot do it properly (btw, there is other old
> open source code that handled nested multiparts also).
Definitely pathetic. However, given that it is a known problem,
it seemed worth mentioning to the original querent.
David
--
David Cassell, OAO cassell@mail.cor.epa.gov
Senior computing specialist
mathematical statistician
------------------------------
Date: Sun, 26 Sep 1999 21:50:40 GMT
From: jgreer@showmethenet.com (Jeff Greer)
Subject: how to "use" my variables in modules
Message-Id: <37f09515.81652593@news-server.kc.rr.com>
Hello,
I am a computer scientist, but newbie Perl programmer. I'm
having trouble with visibility, scope, and lifetime of "my"
variables across modules. How do I use "my" variables across
using "use" ? I've gone through my O'reilly Perl books but I
don't think they explain what I am trying to do very well.
Here is my code. Why can't I use $jeff in test.pl? How do I
make this work?
----------------------------------------------------
#!/usr/bin/perl -w
# test.pl
use CGI qw(:standard);
use strict; # enforce variable declarations and quoting
use test qw( jeff );
print "jeff = $jeff";
print "\n\n";
----------------------------------------------------
#!/usr/bin/perl -w
# test.pm
use strict; # enforce variable declarations and quoting
package test;
my $jeff = "jeff";
----------------------------------------------------
thanks.
--
Jeff Greer
B.S. computer science, University of MO - Rolla
--------------------------------------------------
Windows NT has crashed,
I am the Blue Screen of Death,
No one hears your screams...
If you don't have anything mean to say about
Microsoft, don't say anything at all.
------------------------------
Date: 26 Sep 1999 21:03:00 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: injecting "my" varibales into caller's scope
Message-Id: <7sm1m4$deb$1@gellyfish.btinternet.com>
On 26 Sep 1999 17:50:21 GMT Paul J. Lucas wrote:
> In <slrn7ur3me.9b.abigail@alexandra.delanet.com> abigail@delanet.com (Abigail) writes:
>
>>Paul J. Lucas (tchrist@mox.perl.com) wrote on MMCCXVII September MCMXCIII
>>in <URL:news:37ed65bb$0$206@nntp1.ba.best.com>:
>>{}
>>{} OK, I'll post YOUR address. It meets your criteria: it's
>>{} legal.
>
>>I've reported that fact to abuse@best.com and abuse@verio.com.
>
> Knock yourself out. I'm not forging posts; I'm not claiming
> to be Tom: I'm still using my own name. (Who would want to
> claim to be such an asshole as Tom anyway?)
>
That doesnt wash sucker - you have made several posts using someone
elses address: this is abuse. I had already mailed abuse@best.com but
now the subject has come up ...
/j\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: 26 Sep 1999 21:17:57 GMT
From: ilya@math.ohio-state.edu (Ilya Zakharevich)
Subject: Re: memory use of children
Message-Id: <7sm2i5$1gt$1@charm.magnus.acs.ohio-state.edu>
[A complimentary Cc of this posting was sent to Abigail
<abigail@delanet.com>],
who wrote in article <slrn7urp7g.hh.abigail@alexandra.delanet.com>:
> "" perl -e 'fork while(1)'
> ""
> "" Would probably require the switch to resolve on this machine ...
>
>
> Only on silly OSses. I once did 'perl -we "fork while fork"' on a
> Sparc 4, running Solaris 2.6.
2.6? Maybe. But on 2.3 doing something as simple as
perl -e 'fibo(shift); \
sub fibo {my $a = shift; return 1 if $a < 2; \
fibo($s - 1) + fibo($s - 2) }' 30
would kill the machine (or was it 31? Definitely not more than 32).
Sparc5 would not crash, but you would not be even able to telnet to it.
Ilya
------------------------------
Date: Sun, 26 Sep 1999 21:41:17 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: memory use of children
Message-Id: <1qwH3.433$J66.73139@typ11.nn.bcandid.com>
In article <7sm2i5$1gt$1@charm.magnus.acs.ohio-state.edu>,
Ilya Zakharevich <ilya@math.ohio-state.edu> wrote:
>2.6? Maybe. But on 2.3 doing something as simple as
>
> perl -e 'fibo(shift); \
> sub fibo {my $a = shift; return 1 if $a < 2; \
> fibo($s - 1) + fibo($s - 2) }' 30
>
>would kill the machine (or was it 31? Definitely not more than 32).
>Sparc5 would not crash, but you would not be even able to telnet to it.
Solaris 2 wasn't stable until 2.4, and even 2.5.1 had some significant
stability problems at my site. 2.6 seems to be pretty solid, though.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 26 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 26 Sep 1999 22:27:38 +0200
From: "Rik." <rusenet@bigfoot.com>
Subject: Re: Need a unique "ID" string
Message-Id: <7slv6d$p71$1@voyager.cistron.net>
Russ Allbery <rra@stanford.edu> schreef in berichtnieuws
yl905vgj3k.fsf@windlord.stanford.edu...
> The Smiths <smiths@erols.com> writes:
>
> > I need to generate a unique numeric string that gets recorded each time
> > my PERL cgi is invoked.
>
> > I am currently using time() to do this, but in a high volume situation,
> > I could easily wind up with duplicate ID numbers.
>
> > Is there a better or even standard way to generate guaranteed unique IDs
> > for each invocation of the CGI without using a counter file?
>
> Guaranteed-unique is somewhat hard, but if you use something like:
>
> time() . "-$$"
>
> you'll get a unique ID unless the process exits before a second has passed
> *and* process numbers on your system manage to repeat within the space of
> a second. A lot of Unix software that generates message IDs assumes it's
> a fairly safe bet this won't happen.
>
> --
> #!/usr/bin/perl -- Russ Allbery, Just Another Perl Hacker
> $^=q;@!>~|{>krw>yn{u<$$<[~||<Juukn{=,<S~|}<Jwx}qn{<Yn{u<Qjltn{ > 0gFzD gD,
> 00Fz, 0,,( 0hF 0g)F/=, 0> "L$/GEIFewe{,$/ 0C$~> "@=,m,|,(e 0.), 01,pnn,y{
> rw} >;,$0=q,$,,($_=$^)=~y,$/ C-~><@=\n\r,-~$:-u/ #y,d,s,(\$.),$1,gee,print
Try the users IP plus time.
Rik
------------------------------
Date: 26 Sep 1999 20:38:23 GMT
From: revjack <revjack@radix.net>
Subject: Re: Need a unique "ID" string
Message-Id: <7sm07v$k37$1@news1.Radix.Net>
Keywords: Hexapodia as the key insight
Rik. explains it all:
:Try the users IP plus time.
Urk. Where I work I routinely get several hits per second from
"proxy1.customer.com". Don't do this.
------------------------------
Date: 26 Sep 1999 16:00:54 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Randomize array.....
Message-Id: <slrn7ut2qm.88i.abigail@alexandra.delanet.com>
Yanick Champoux (yanick@comnet.com) wrote on MMCCXVII September MCMXCIII
in <URL:news:rustn1ge3i56@corp.supernews.com>:
$$
$$ #! /usr/bin/perl
$$
$$ srand;
$$
$$ my @num = ( 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 );
$$
$$ @result = sort By_Random @array;
$$ sub By_Random
$$ {
$$ return (-1,1)[rand(2)]; # return -1 or 1 at random
$$ }
$$
$$ print join ' ', @result, "\n";
That's undefined behaviour.
Abigail
--
%0=map{reverse+chop,$_}ABC,ACB,BAC,BCA,CAB,CBA;$_=shift().AC;1while+s/(\d+)((.)
(.))/($0=$1-1)?"$0$3$0{$2}1$2$0$0{$2}$4":"$3 => $4\n"/xeg;print#Towers of Hanoi
-----------== 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: Sun, 26 Sep 1999 21:39:02 GMT
From: kragen@dnaco.net (Kragen Sitaker)
Subject: Re: Randomize array.....
Message-Id: <WnwH3.426$J66.72981@typ11.nn.bcandid.com>
In article <rustn1ge3i56@corp.supernews.com>,
Yanick Champoux <yanick@comnet.com> wrote:
>@result = sort By_Random @array;
>sub By_Random
>{
> return (-1,1)[rand(2)]; # return -1 or 1 at random
>}
Two things:
1. many sort routines will crash if given such a comparison function.
I don't know if Perl's is one of them. Other sort routines will
run forever under these circumstances.
2. the distribution you get may be distinctly nonrandom; again, I don't
know if Perl's sort has this property or not.
--
<kragen@pobox.com> Kragen Sitaker <http://www.pobox.com/~kragen/>
Sun Sep 26 1999
43 days until the Internet stock bubble bursts on Monday, 1999-11-08.
<URL:http://www.pobox.com/~kragen/bubble.html>
------------------------------
Date: Sun, 26 Sep 1999 20:11:00 GMT
From: "Samuel Kilchenmann" <skilchen@swissonline.ch>
Subject: Re: remove the html tag in the file
Message-Id: <o5vH3.19039$m4.76036799@news.magma.ca>
Abigail <abigail@delanet.com> wrote in:
news:slrn7urr3l.hh.abigail@alexandra.delanet.com...
> Samuel Kilchenmann (skilchen@swissonline.ch) wrote on MMCCXV September
> MCMXCIII in <URL:news:EVRG3.18678$m4.75164111@news.magma.ca>:
> == turboman <turboman34@hotmail.com> wrote in:
> == news:7sgfib$t84$1@winter.news.rcn.net
> ==
> == > Is anyone know how can I use perl to remove all the HTML TAGs in
> == > the html file. Thanks.
> == >
== You may want to use a more appropriate tool than Perl for things like
== that
[silly REBOL example snipped]
Everybody is able to see, that i posted a silly example. But somebody
may be able to get my point, that REBOL provides a nice and powerful
infrastructure to write correct solutions for this kind of parsing
problems.
HTML::Parser maybe appropriate for the task turboman described, but even
you stated in an other posting that HTML::Parser has serious flaws. Why
should i care about the OO silliness of subclassing HTML::Parser if
there are tools, which don't force me in the strange world of OO. (I
agree, that this statement again may be too inflammatory.)
Surely HTML::Parser (and its relatives) is neither easy to understand
nor easy to use.
>
> Well, duh, I can write the equivalent Perl code in half a line.
>
Please show me, how you do this in half a line of Perl:
- read a page from a http URL
- accumulate all tags in a list
- accumulate all text in a string
The solution doesn't need to be any better than the silly REBOL example.
> However, what does this have to do with removing HTML tags? Not much,
> except that in some cases you're lucky and it appears to work.
>
Ok, but smart people like you are able to enhance the example to work
correctly in an understandable way and the amount of time needed to do
that using REBOL will be very likely much smaller than what you invested
in learning Perl and regexps.
Btw. i have no intention to start a language war, i only wanted to point
to a new language, which may be a useful tool to deal with parsing
problems. (And indeed, I prefer REBOL's infrastructure to networking and
parsing to the one provided by Perl. Everybody reading my postings must
immediately see, that i have serious problems with the english language,
so i am sorry, if my way to express my point of view about the
appropriateness of tools itself was inappropriate. And now i have to
play some more with REBOL, so i immediately return to lurking.)
------------------------------
Date: 26 Sep 1999 15:56:14 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: remove the html tag in the file
Message-Id: <slrn7ut2ht.88i.abigail@alexandra.delanet.com>
Samuel Kilchenmann (skilchen@swissonline.ch) wrote on MMCCXVII September
MCMXCIII in <URL:news:o5vH3.19039$m4.76036799@news.magma.ca>:
@@ Abigail <abigail@delanet.com> wrote in:
@@ news:slrn7urr3l.hh.abigail@alexandra.delanet.com...
@@ > Samuel Kilchenmann (skilchen@swissonline.ch) wrote on MMCCXV September
@@ > MCMXCIII in <URL:news:EVRG3.18678$m4.75164111@news.magma.ca>:
@@ > == turboman <turboman34@hotmail.com> wrote in:
@@ > == news:7sgfib$t84$1@winter.news.rcn.net
@@ > ==
@@ > == > Is anyone know how can I use perl to remove all the HTML TAGs in
@@ > == > the html file. Thanks.
@@ > == >
@@
@@ == You may want to use a more appropriate tool than Perl for things like
@@ == that
@@
@@ [silly REBOL example snipped]
@@
@@ Everybody is able to see, that i posted a silly example. But somebody
@@ may be able to get my point, that REBOL provides a nice and powerful
@@ infrastructure to write correct solutions for this kind of parsing
@@ problems.
Sorry. No. I cannot see for your incorrect solution how good Rebol is in
making correct solutions. Or should we point to Matt Wrights collective
works to prove how easy it is to write correct Perl programs?
@@ HTML::Parser maybe appropriate for the task turboman described, but even
@@ you stated in an other posting that HTML::Parser has serious flaws. Why
@@ should i care about the OO silliness of subclassing HTML::Parser if
@@ there are tools, which don't force me in the strange world of OO. (I
@@ agree, that this statement again may be too inflammatory.)
@@ Surely HTML::Parser (and its relatives) is neither easy to understand
@@ nor easy to use.
HTML::Parser might have flaws, it's way, way better than assuming every
< starts a tag, which is terminated by the next >. HTML::Parsers biggest
problem is its lack of knowledge of HTML. Does Rebol have a DTD build in?
@@ > Well, duh, I can write the equivalent Perl code in half a line.
@@ >
@@ Please show me, how you do this in half a line of Perl:
@@ - read a page from a http URL
@@ - accumulate all tags in a list
@@ - accumulate all text in a string
I never said I could do all three in half a line, but I can do all three
in a single line:
Printing the tags first, then the text:
perl -MLWP::Simple -e '$_ = get ("URL"); print /<([^>*])>/, />([^<]*)</'
@@ The solution doesn't need to be any better than the silly REBOL example.
@@
@@ > However, what does this have to do with removing HTML tags? Not much,
@@ > except that in some cases you're lucky and it appears to work.
@@ >
@@ Ok, but smart people like you are able to enhance the example to work
@@ correctly in an understandable way and the amount of time needed to do
@@ that using REBOL will be very likely much smaller than what you invested
@@ in learning Perl and regexps.
Really? Prove it. Don't come with stupid examples that don't work.
@@ Btw. i have no intention to start a language war, i only wanted to point
Bullocks. Read your previous paragraph. If you don't intent to start
a language war, don't post statements like that.
Abigail
--
package Just_another_Perl_Hacker; sub print {($_=$_[0])=~ s/_/ /g;
print } sub __PACKAGE__ { &
print ( __PACKAGE__)} &
__PACKAGE__
( )
-----------== 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: 26 Sep 1999 21:42:45 -0000
From: Jonathan Stowe <gellyfish@gellyfish.com>
Subject: Re: remove the html tag in the file
Message-Id: <7sm40l$dmq$1@gellyfish.btinternet.com>
On 26 Sep 1999 15:56:14 -0500 Abigail wrote:
> Samuel Kilchenmann (skilchen@swissonline.ch) wrote on MMCCXVII September
> MCMXCIII in <URL:news:o5vH3.19039$m4.76036799@news.magma.ca>:
> @@ Ok, but smart people like you are able to enhance the example to work
> @@ correctly in an understandable way and the amount of time needed to do
> @@ that using REBOL will be very likely much smaller than what you invested
> @@ in learning Perl and regexps.
>
> Really? Prove it. Don't come with stupid examples that don't work.
>
> @@ Btw. i have no intention to start a language war, i only wanted to point
>
> Bullocks. Read your previous paragraph. If you don't intent to start
> a language war, don't post statements like that.
>
At this point I might add that I got mailed by someone from rebol.com:
<QUOTE>
I found you in a Perl discussion group and would like to inquire if you
might be interested in working with the REBOL language.
REBOL is a messaging/scripting language built for the Internet, available
on 36 platforms (50 by the end of the year including hand held devices),
with a footprint of 150-190K for most platforms, readable with the human
eye and downloads free from our website.
We are of the opinion that REBOL will become the "Global Standard in
Networked Intercommunications" and we are looking for sharp scripters.
Jonathan, this is a very exciting opportunity to work with a great team in
a beautiful place with bleeding edge technology.
Please take a look at REBOL. I am very interested in what you think.
</QUOTE>
Sounds like some sort of crusade to me.
What was that other 'language' that they were pushing like this last year ?
/J\
--
Jonathan Stowe <jns@gellyfish.com>
<http://www.gellyfish.com>
Hastings: <URL:http://dmoz.org/Regional/UK/England/East_Sussex/Hastings>
------------------------------
Date: Sun, 26 Sep 1999 14:20:14 -0700
From: Phil Doe <ask_for_my_address_if_you_need_it@earthlink.net>
Subject: Trouble with CPAN module
Message-Id: <37EE8E0E.9913F889@earthlink.net>
Hello and thanks for helping. :)
I recently decided to remove the binary RPM installation of Perl that
came with Redhat 5.1 and replace it with the latest, stable source
distribution. All went relatively smoothly until I attempted to use the
CPAN module to install other modules.
I had to manually download and install each module normally installed
via:
cpan> install Bundle::CPAN
Only one of these gave problems:
root@localhost ~/Archive-Tar-0.21]# make test
PERL_DL_NONLAZY=1 /usr/bin/perl -Iblib/arch -Iblib/lib
-I/usr/lib/perl5/5.00503/i586-linux-thread -I/usr/lib/perl5/5.00503
test.pl
1..5
ok 1
ok 2
ok 3
ok 4
Can't call method "gzseek" on an undefined value at
blib/lib/Archive/Tar.pm line 785.
make: *** [test_dynamic] Error 9
I'm not sure what to do about this or if it impacts on the greater
problem of installing other modules, so I went ahead and did the make
install. (Not a good idea, but I really couldn't figure out how to fix
that problem -- I figured that I'd best wait and see if it became a
'real' problem.)
Having installed these Bundle modules by hand, I still couldn't install
a simple module like Expect or Tk via cpan> as root:
cpan> install Expect
Going to read y/sources/authors/01mailrc.txt.gz
CPAN: Compress::Zlib loaded ok
Going to read y/sources/modules/02packages.details.txt.gz
Scanning cache y/build for sizes
Going to read y/sources/modules/03modlist.data.gz
Running make for AUSCHUTZ/Expect.pm-1.07.tar.gz
CPAN: Net::FTP loaded ok
Fetching with Net::FTP:
ftp://ftp.cpan.org/CPAN/authors/id/AUSCHUTZ/Expect.pm-1.07.tar.gz
CPAN: MD5 loaded ok
Fetching with Net::FTP:
ftp://ftp.cpan.org/CPAN/authors/id/AUSCHUTZ/CHECKSUMS
Could not gzopen y/sources/authors/id/AUSCHUTZ/Expect.pm-1.07.tar.gz at
/usr/lib/perl5/5.00503/CPAN.pm line 4207.
Any advice on what I should do to get CPAN working (advice on the
Archive-Tar modules would be spiffy also :) ) ?
Thanks,
Phil=>pvoris_doesn't_like_spam@earthlink.net
------------------------------
Date: Sun, 26 Sep 1999 22:26:48 +0200
From: "Rik." <rusenet@bigfoot.com>
Subject: Where did comp.lang.perl go?
Message-Id: <7slv4r$p14$1@voyager.cistron.net>
I posted a question this afternoon but now the ng just dissapeared!
Rik
------------------------------
Date: 26 Sep 1999 16:38:35 -0400
From: meow <meowing@banet.net>
Subject: Re: Where did comp.lang.perl go?
Message-Id: <873dw1h0hg.fsf@slip-32-101-160-194.ma.us.ibm.net>
Rik <rusenet@bigfoot.com> wrote:
> I posted a question this afternoon but now the ng just dissapeared!
It disappeared in May 1995, when it was renamed to
comp.lang.perl.misc. It would seem that cistron is *very* far behind
in its server upkeep.
------------------------------
Date: Sun, 26 Sep 1999 22:49:11 +0200
From: "Rik." <rusenet@bigfoot.com>
Subject: Re: Where did comp.lang.perl go?
Message-Id: <7sm0eq$tc2$1@voyager.cistron.net>
meow <meowing@banet.net> schreef in berichtnieuws
873dw1h0hg.fsf@slip-32-101-160-194.ma.us.ibm.net...
> Rik <rusenet@bigfoot.com> wrote:
>
> > I posted a question this afternoon but now the ng just dissapeared!
>
> It disappeared in May 1995, when it was renamed to
> comp.lang.perl.misc. It would seem that cistron is *very* far behind
> in its server upkeep.
Strange. :-)
I read other messages in the group this afternoon:-)
------------------------------
Date: 26 Sep 1999 16:01:35 -0500
From: abigail@delanet.com (Abigail)
Subject: Re: Where did comp.lang.perl go?
Message-Id: <slrn7ut2rv.88i.abigail@alexandra.delanet.com>
Rik. (rusenet@bigfoot.com) wrote on MMCCXVII September MCMXCIII in
<URL:news:7slv4r$p14$1@voyager.cistron.net>:
__ I posted a question this afternoon but now the ng just dissapeared!
comp.lang.perl went about 4 years ago.
Abigail
--
sub _'_{$_'_=~s/$a/$_/}map{$$_=$Z++}Y,a..z,A..X;*{($_::_=sprintf+q=%X==>"$A$Y".
"$b$r$T$u")=~s~0~O~g;map+_::_,U=>T=>L=>$Z;$_::_}=*_;sub _{print+/.*::(.*)/s}
*_'_=*{chr($b*$e)};*__=*{chr(1<<$e)};
_::_(r(e(k(c(a(H(__(l(r(e(P(__(r(e(h(t(o(n(a(__(t(us(J())))))))))))))))))))))))
-----------== 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: Sun, 26 Sep 1999 23:58:59 +0200
From: "Trond Michelsen" <mike@crusaders.no>
Subject: Re: where to write perl???
Message-Id: <7DwH3.1369$s82.7464@news1.online.no>
Cameron Dorey <camerond@mail.uca.edu> wrote in message
news:37EE689F.2EAB47F6@mail.uca.edu...
> unclear). I don't have the CD Bookshelf and thought that you meant that
> it came on 2 CD's. It's a lot of material there. (But I should guess,
> when I think about it, not quite 650 MB worth, anyone care to tell me
> how much?).
About 25MB.
--
Trond Michelsen
------------------------------
Date: Sun, 26 Sep 1999 15:38:59 -0500
From: Cameron Dorey <camerond@mail.uca.edu>
To: todd@mda.ca
Subject: Re: Which are the best books for learning Perl for use in a Web
Message-Id: <37EE8463.1695C308@mail.uca.edu>
[cc'd to ts]
Todd Strilchuk wrote:
>
> > taken from Cameron Dorey (Sep 25)...
>
> >> I wish to learn Perl for use in a Web environment. The following books
> >> seem to come recommended by many people are they relevant for Web
> >> programming?
> >>
> >> Learning Perl, Programming Perl, Perl Cookbook
> >
> >Learning Perl on Win32 Systems (an adaptation of Learning Perl)
> >
> >The Official Guide to CGI.pm
> >
> >Perl Cookbook
>
> not sure if you use these books yourself... but i wouldn't recommend
> buying them. don't get me wrong, i'm a big o'reilly fan (usually
> that's all i buy), but it doesn't make sense to tell someone to buy:
>
> perl cookbook ($39.95)
> learning perl on win32 systems ($29.95)
>
> for a total of $69.90, when you can tell them to buy:
>
> the perl cd bookshelf ($59.95)
>
> it'll save you $10, plus you get a lot more for your money. [more detailed description snipped]
Actually, yes, I have and use these books, plus the Camel (which I don't
use nearly as much, just the way I work, I guess). I wouldn't recommend
(or trash) any book I have not used or tried to use. Since I have the
Gecko, the Llama wouldn't be much good to me, I'm not nearly up to using
Advanced Perl at this point, and, to be honest, I'm not sure just how
much additional help Perl in a Nutshell would be, although I've
considered it.
I _like_ books, I have been called a Luddite at times, but for me, it's
not always convenient to pull out my laptop in an airport (usually after
finding an outlet ;^) ) just to read up on something that has been
bugging me and I want to understand a little better, not necessarily to
try right now. Sometimes it's also easier to have a book in front of you
beside your screen, instead of switching windows incessantly to
read/code/read/code... It also does my eyes good to get them off of a
computer screen for a little bit from time to time ;^).
If the original poster wants to get the CD, fine. Sometimes I wish I had
it myself (or at least the CD's of the books I _do_ have, acquired at
nominal additional cost, but Tim hasn't seen fit to do things that way).
I really assumed that he would probably check out O'Reilly on the web
and see what is there (hence the subtle hint).
Cameron
--
Cameron Dorey
Associate Professor of Chemistry
University of Central Arkansas
Phone: 501-450-5938
camerond@mail.uca.edu
------------------------------
Date: Sun, 26 Sep 1999 22:25:32 +0200
From: "Rik." <rusenet@bigfoot.com>
Subject: Why does my code NOT work?
Message-Id: <7slv2f$osd$1@voyager.cistron.net>
I'm working on a cgi, which should do the following
i do http://www.mysite.com/cooldir/myscript.cgi?id=abcd&pwd=password which
is of course a GET command.
The script goes fine, BUT when i pass in the part marked with # HEY I PASSED
THIS IN the whole thing ends up with an Server error. All files do exist.
What the script does: it checks if file "abcd" exists, and if so, it
compares line 0 with pwd's value. If these two are the same, it prints line
1 and 2 on the screen.
The script:
#!/usr/local/bin/perl
$dir = "";
print "Content-Type: text/html\n\n";
#We dont need this cuz its always GET
#if ($ENV{'REQUEST_METHOD'} eq "GET") {
# $buffer = $ENV{'QUERY_STRING'};
# }
#elseif ($ENV{'REQUEST_METHOD'} eq "POST") {
# read(STDIN, $buffer,
$ENV{'CONTENT_LENGTH'});
# }
$buffer = $ENV{'QUERY_STRING'};
@pairs = split(/&/, $buffer);
foreach $pair (@pairs) {
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%(..)/pack("c", hex($1))/eg;
$INPUT{$name} = $value;
}
print "$INPUT{'id'}\n\n";
print "$INPUT{'pwd'}\n\n";
# HEY I PASSED THIS IN
$INPUT_FILE = $INPUT{'id'};
if (-e INPUT_FILE) then {
open(INPUT_FILE) or die "FOUT";
@lines = <INPUT_FILE>;
close(INPUT_FILE);
if ($INPUT{'pwd'} eq $lines[0]) {
print "$lines[1]\n"
print "$lines[2]\n"
} else{
print "Ongeregistreerde versie.";
}
}else{
print "Ongeregistreerde versie.";
}
----------------
Now anyone who knows what is wrong about this?
Thanks a lot!
Rik
------------------------------
Date: Sun, 26 Sep 1999 14:46:58 -0700
From: Dan Woods <dwoods@ucalgary.ca>
To: Tom Christiansen <tchrist@mox.perl.com>
Subject: Re: You should be admired, or What does this have to do with Perl?
Message-Id: <7sm13k$beg@ds2.acs.ucalgary.ca>
Hello,
Tom Christiansen wrote:
> [courtesy cc of this posting mailed to cited author]
Appreciated :)
> In comp.lang.perl.misc,
> Dan Woods <dwoods@ucalgary.ca> writes:
> :That depends on what you mean by popular. I would classify Perl, UNIX,
> :C, Java, sh/csh/ksh/awk, Vi/Emacs editors into the category of
> :"definitely not for beginners".
>
> That's completely bizarre. These are what beginners used when they
> signed up for a programming class at university. Oh, we didn't have
> Perl, Java, or ksh when I was at college, but the rest of them (BSD Unix
> on a PDP-11, csh, and vi) were certainly standard. And people with no
> programming background used them. And no, they weren't all destined to
> become professionals. Plenty of non-majors were in those classes.
>
> I happen to think that that generation turned out fine, and certainly
> they were beginners at the time.
To be more specific (or clearer), I meant they aren't the easiest
ones to learn. They take time and experience to to "get it".
Thanks...Dan.
------------------------------
Date: 26 Sep 1999 21:31:00 GMT
From: michel.dalle@usa.net (Michel Dalle)
Subject: Re: You should be admired
Message-Id: <7sm3ak$j9q$1@xenon.inbe.net>
jwc@acsu.buffalo.edu (James W Corpening) wrote in
<37E8FC1F.D130A86F@acsu.buffalo.edu>:
<snip>
>Ya know, some of you illiterates are real idiots. I write in perl, and
>I use submit buttons in my html portions, as probably many of you do.
>Consequently, I thought to rely on the perl group (the MISC group) to
>help me. I appreciate the answers I received among the righteous
>scoldings, but lighten up, kick your dog, or find some other catharsis
>for your anger. The next time you ask your buddy what he thinks of the
>Dallas Cowboys, unless he plays for them, call yourself a hypocrite. -jc
>
Hmm, I see I missed another one of those (in)famous Perl threads...
Well, there'll be another one next week, I suppose :-)
Michel.
------------------------------
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 915
*************************************