[24195] in Perl-Users-Digest
Perl-Users Digest, Issue: 6387 Volume: 10
daemon@ATHENA.MIT.EDU (Perl-Users Digest)
Mon Apr 12 03:05:55 2004
Date: Mon, 12 Apr 2004 00:05:09 -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 Mon, 12 Apr 2004 Volume: 10 Number: 6387
Today's topics:
Re: "perl -w" vs "use warnings" <jtc@shell.dimensional.com>
Re: how call whois information? <gp@nospm.hr>
Installing DBD::Sybase when there is no compiler (Yash)
Interacting w/another App on Win32 (Anthony M. Saffer)
Re: Interacting w/another App on Win32 <dwall@fastmail.fm>
Re: Is there a way to call Perl/Tk from Apache server <Joe.Smith@inwap.com>
Re: Is there a way to call Perl/Tk from Apache server <Joe.Smith@inwap.com>
Message To America's Students: The War, The Draft, Your jason@Vote.Nader.2004
Need help with Parsing HTML <dannywork5@hotmail.com>
Re: Need help with Parsing HTML <invalid-email@rochester.rr.com>
Re: new bbs <matthew.garrish@sympatico.ca>
perldoc incompetence: perlre /s (Xah Lee)
Re: perldoc incompetence: perlre /s <postmaster@castleamber.com>
Re: perldoc incompetence: perlre /s <uri@stemsystems.com>
Re: perldoc incompetence: perlre /s <tore@aursand.no>
Re: perldoc incompetence: perlre /s <xxala_qumsiehxx@xxyahooxx.com>
Problem building Perl 5.8.3 <nb_no_spam@synthcom.com>
regex not matching high end (Anatase)
Re: Returning multiple values <jkrugman@yahbitoo.com>
Re: Returning multiple values <invalid-email@rochester.rr.com>
What about this script? HTML::Parser <dannywork5@hotmail.com>
Why doesn't this UserAgent script work? <Tigerhillsideremove@removenetscape.net>
Re: Why doesn't this UserAgent script work? <doc@CONSORTIUM.RedBrick.DCU.IE.small.carrots>
Re: Why doesn't this UserAgent script work? <tore@aursand.no>
Re: Why doesn't this UserAgent script work? <Tigerhillsideremove@removenetscape.net>
Re: Why doesn't this UserAgent script work? <Tigerhillsideremove@removenetscape.net>
Digest Administrivia (Last modified: 6 Apr 01) (Perl-Users-Digest Admin)
----------------------------------------------------------------------
Date: 11 Apr 2004 13:43:20 -0600
From: Jim Cochrane <jtc@shell.dimensional.com>
Subject: Re: "perl -w" vs "use warnings"
Message-Id: <slrnc7j7uo.mob.jtc@shell.dimensional.com>
In article <6a73bb68.0404091300.340dc23@posting.google.com>, neo88 wrote:
> Joe Smith <Joe.Smith@inwap.com> wrote in message news:<_yudc.97920$gA5.1309464@attbi_s03>...
>> Jim Cochrane wrote:
>>
>> > In article <4075da0d$0$24341$58c7af7e@news.kabelfoon.nl>, John Bokma wrote:
>> >>>>#!/usr/bin/perl -w
>> >>
>> >>use warnings;
>> >>
>> >>not -w
>> >
>> >
>> > Sorry to get off the topic of the thread, but I've been wondering whether
>> > it's best to include "use warnings" in a module file or just use the -w
>> > option when the program is run. So, with that background, I'll ask:
>> >
>> > Why do you suggest the "use warnings" method?
>>
>> Some modules produce warnings when processed with -w, which affects
>> all files the compiler processes. "use warnings;" is file-scoped.
>> -Joe
>
> well, -w is a much older command-line option to show interpeter
> warnings before the script\program ran. Now Larry has come up with
> something I guess he thinks is better.
> use warnings;
> this alows the programmer to custimize the warning output a wee bit.
> use strict;
> no vars;
> etc. and like Joe said, use warnings is file scoped which can be nice.
Thanks. I guess part of my confusion was caused by reading the
"Effective Perl ..." book, which (I've realized as a result of this
discussion) was written before "use warnings" was added and thus
recommends using -w.
--
Jim Cochrane; jtc@dimensional.com
[When responding by email, include the term non-spam in the subject line to
get through my spam filter.]
------------------------------
Date: Mon, 12 Apr 2004 01:05:56 +0200
From: "PHP2" <gp@nospm.hr>
Subject: Re: how call whois information?
Message-Id: <c5ciun$5ie$1@ls219.htnet.hr>
yes, same way like always :-))
thanks
"Matt Garrish" <matthew.garrish@sympatico.ca> wrote in message
news:MB%dc.43428$wq4.2713178@news20.bellglobal.com...
>
> "Gregory Toomey" <nospam@bigpond.com> wrote in message
> news:2428969.zH4ZYbU3kk@GMT-hosting-and-pickle-farming...
> > PHP2 wrote:
> >
> > > how call whois information for set of domains with Perl?
> >
> > You should read the documentation.
> >
> >
> > my $whois = `whois site.com`
> >
> > for (split '\n', qx(whois site.com)) {
> > ...
> > }
> >
>
> Or better yet, use a module:
>
> http://search.cpan.org/~dhudes/Net-Whois-1.9/Whois.pm
>
> Matt
>
>
------------------------------
Date: 11 Apr 2004 22:43:28 -0700
From: yashgt@yahoo.com (Yash)
Subject: Installing DBD::Sybase when there is no compiler
Message-Id: <5a373b1d.0404112143.393220f0@posting.google.com>
Hi,
At our customer's site, there is Perl 5.6.1 installed on HP-Ux 11.
This does not have the DBD::Sybase perl module. For the new version of
our application, we are required to interact with an SQL Server 2000
database running on a remote Windows machine.
We managed to build and install the module on our development
machines. For this we had to first install FreeTDS as the driver.
While doing a make of the Sybase module , we had to give the location
of the FreeTDS in an env. variable. The module was built and
installed. However, the Sybase.pm file uses Sybase.sl which tries to
load /home/myhome/freetds/lib/libtds.sl.3.
/home/myhome/freetds is where we installed the FreeTDS on the
development machine. However on the customer's machine, FreeTDS may be
installed in some other directory.
On the customer's site, there is not compiler present. So we will have
to ship the pre-built perl module.
Can someone suggest how to build the perl module on the dev. machine
so that the packaged module does not depend on the location of the
libraries it uses.
Thanks
------------------------------
Date: 11 Apr 2004 14:35:45 -0700
From: anthonysaffer@yahoo.com (Anthony M. Saffer)
Subject: Interacting w/another App on Win32
Message-Id: <ff7f1f07.0404111335.18b0a1b2@posting.google.com>
Hello Everyone,
I'm trying to find some information about how to do something but I
don't even know what to search for. Here's the deal: I am writing a
visual interface to Win32 command line tool. At some point, I will
need to pass information to and read information from the other
application. Is there a way to do this in Perl without the need to
spawn a "DOS window"?
Thanks,
Anthony
------------------------------
Date: Sun, 11 Apr 2004 23:17:21 -0000
From: "David K. Wall" <dwall@fastmail.fm>
Subject: Re: Interacting w/another App on Win32
Message-Id: <Xns94C8C434038dkwwashere@216.168.3.30>
anthonysaffer@yahoo.com (Anthony M. Saffer) wrote:
> Hello Everyone,
>
> I'm trying to find some information about how to do something but I
> don't even know what to search for. Here's the deal: I am writing a
> visual interface to Win32 command line tool. At some point, I will
> need to pass information to and read information from the other
> application. Is there a way to do this in Perl without the need to
> spawn a "DOS window"?
perldoc -f system
perldoc -f exec
Or look in perlop for qx/STRING/ or `STRING` (backticks, not single-quotes).
------------------------------
Date: Mon, 12 Apr 2004 05:52:54 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Is there a way to call Perl/Tk from Apache server
Message-Id: <W8qec.121408$K91.334572@attbi_s02>
oracle wrote:
> Unless there is a way to send execute ../cgi-bin/tk-test and send the
> GUI to user session....
You can send a screenshot to the user as a GIF or PNG image, but you
cannot send the GUI to the user with just HTTP. You'll need a TCP-aware
GUI running on the end user's computer, like a Java applet.
-Joe
------------------------------
Date: Mon, 12 Apr 2004 05:57:55 GMT
From: Joe Smith <Joe.Smith@inwap.com>
Subject: Re: Is there a way to call Perl/Tk from Apache server
Message-Id: <Ddqec.114198$gA5.1464365@attbi_s03>
oracle wrote:
> If one creates a form using Perl, It can be displayed in a browser.
> I was hoping to be able to do the same with the Perl/Tk pogrom too!
You can use Perl/Tk running on your computer _instead_ of a browser,
not in a browser. It's something that you install on a client, not server.
-Joe
------------------------------
Date: Sun, 11 Apr 2004 22:51:22 GMT
From: jason@Vote.Nader.2004
Subject: Message To America's Students: The War, The Draft, Your Future
Message-Id: <a54bb723.f71446a5@host-69-48-73-244.roc.choiceone.net>
We have been down this road before.
U.S. troops sent to war half a world away. American foreign policy
controlled by an arrogant elite, bent on projecting military power
around the globe. A public misled into supporting an unconstitutional
war founded on deceit and fabrications.
As the death toll mounts, we hear claims that the war is nearly won,
that victory is just around the corner. But victory never arrives.
As the public loses confidence in the government, the government
questions the patriotism of any who express doubt about the war.
When a presidential election arrives, both the Democrat and Republican
nominees embrace the policy of continued war.
The military draft comes to dominate the lives of America's young, and
vast numbers who believe the war to be a senseless blunder are faced
with fighting a war they do not believe in, or facing exile or prison.
The year was 1968. Because voters had no choice that November, the
Vietnam War continued for another six years. Hundreds of thousands of
Americans like you died, were maimed, or suffered from diseases like
malaria. A far greater number of Vietnamese died.
Today, the war is in the quicksands and alleys of Iraq. Once again,
under the pressure of a determined resistance, we see an American war
policy being slowly torn apart at the seams, while the candidates urge
us to "stay the course" in this tragic misadventure. Today's
Presidential candidates are not Nixon and Humphrey, they are now Bush
and Kerry.
Once again, there is one overriding truth: If war is the only choice in
this election, then war we will have.
Today enlistments in the Reserves and National Guard are declining. The
Pentagon is quietly recruiting new members to fill local draft boards,
as the machinery for drafting a new generation of young Americans is
being quietly put into place.
Young Americans need to know that a train is coming, and it could run
over their generation in the same way that the Vietnam War devastated
the lives of those who came of age in the sixties.
I am running for President, and have been against this war from the
beginning. We must not waste lives in order to control and waste more
oil. Stand with us and we may yet salvage your future and Americas'
future from this looming disaster.
Sincerely,
Ralph Nader
HTTP://WWW.VOTENADER.ORG
--
of
Marxism-Leninism-Maoism and its military strategy, people's war, the
Palestinian people's fight will surely become .more integral part of the
world revolution, hastening the day when imperialism, Zionism .meet their
doom."
These Maoist terrorist organizations are financing their activities by
trafficking in controlled substances. According to December 13, 2000,
testimony by Frank Cilluffo, to the U.S. House Committee on the Judiciary
Subcommittee on Crime, the Kurdistan Workers Party (PKK) " is heavily
involved in the European drug trade, especially in Germany and France.
French law enforcement estimates that the PKK smuggles 80 percent of the
heroin in Paris." Cilluffo is Deputy Director, Global Organized Crime
Program Counterterrorism Task Force at Washington, D.C.'s Center for
Strategic and International Studies.
This same testimony reveals the Nepal Communist Party, ".turned to drug
trafficking for funding. Nepal serves as a hub for hashish trafficking in
Asia." The CIA Fact Book lists Nepal as a major source for heroin from
Southeast Asia to t
------------------------------
Date: Mon, 12 Apr 2004 00:06:51 GMT
From: "Danny" <dannywork5@hotmail.com>
Subject: Need help with Parsing HTML
Message-Id: <v4lec.35098$Eg.8146623@news4.srv.hcvlny.cv.net>
I would like to parse an HTML file by extracting the the contents of a form.
Like the form objects such as the values and names
name = idnumber value = 4
name = productname value = scooter
there are a few forms per page to read in, I would like to store in an array
or to a text file
Thanks in advance
------------------------------
Date: Mon, 12 Apr 2004 00:58:39 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Need help with Parsing HTML
Message-Id: <4079E8D9.5000204@rochester.rr.com>
Danny wrote:
> I would like to parse an HTML file by extracting the the contents of a form.
> Like the form objects such as the values and names
> name = idnumber value = 4
> name = productname value = scooter
> there are a few forms per page to read in, I would like to store in an array
> or to a text file
...
Modules are your friend. For this, check out the HTML::Parser module:
perldoc HTML::Parser
This module should already be on your hard drive.
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Mon, 12 Apr 2004 00:08:32 -0400
From: "Matt Garrish" <matthew.garrish@sympatico.ca>
Subject: Re: new bbs
Message-Id: <YCoec.1757$2Z6.197142@news20.bellglobal.com>
"Robin" <robin @ infusedlight.net> wrote in message
news:c5ad39$cqo$1@reader2.nmix.net...
> http://www.infusedlight.net/robin/bbs/bbs.pl?action=view
> my latest opus. I hope you like it. I'd like to see if some hacker can
hack
> this baby. I uses cgi.pm and is way more secure.
> Admin script isn't done yet.
>
Took all of two minutes to hack you...
Matt
------------------------------
Date: 11 Apr 2004 19:59:03 -0700
From: xah@xahlee.org (Xah Lee)
Subject: perldoc incompetence: perlre /s
Message-Id: <7fe97cc4.0404111859.723473ed@posting.google.com>
today i'm writing some perl code involving regex. I wanted to find out
exactly what is /s (whitespace) is defined. So i did "perldoc -t
perlre".
Fucking no mention of it. Fuck Perl and fuck Perl coders.
Xah
xah@xahlee.org
http://xahlee.org/PageTwo_dir/more.html
------------------------------
Date: Sun, 11 Apr 2004 22:07:02 -0500
From: John Bokma <postmaster@castleamber.com>
Subject: Re: perldoc incompetence: perlre /s
Message-Id: <407a07d7$0$24349$58c7af7e@news.kabelfoon.nl>
Xah Lee wrote:
> today i'm writing some perl code involving regex. I wanted to find out
> exactly what is /s (whitespace) is defined. So i did "perldoc -t
> perlre".
You mean \s?
--
John personal page: http://johnbokma.com/
Experienced Perl / Java developer available - http://castleamber.com/
------------------------------
Date: Mon, 12 Apr 2004 03:34:08 GMT
From: Uri Guttman <uri@stemsystems.com>
Subject: Re: perldoc incompetence: perlre /s
Message-Id: <x7r7uthntb.fsf@mail.sysarch.com>
>>>>> "XL" == Xah Lee <xah@xahlee.org> writes:
XL> today i'm writing some perl code involving regex. I wanted to find out
XL> exactly what is /s (whitespace) is defined. So i did "perldoc -t
XL> perlre".
XL> Fucking no mention of it. Fuck Perl and fuck Perl coders.
you are a fucking moron. but what else is new?
In addition, Perl defines the following:
\s Match a whitespace character
space \s [2]
[2] Not I<exactly equivalent> to C<\s> since the C<[[:space:]]> includes
also the (very rare) `vertical tabulator', "\ck", chr(11).
now, what characters could be considered whitespace? ever think about
checking other references about it? i doubt your brane could comprehend
such a thought, that perl relies on other docs too! oy vey!! perl is so
bad because the entire world of computing docs are not in its >1k
pages!! oh let larry shoot himself for that omission!
man isspace
isspace()
Tests for any space, tab, carriage-return, newline,
vertical-tab or form-feed (standard white-space char-
acters) or for one of the current locale-defined set
of characters for which isalnum() is false. In the C
locale, isspace() returns true only for the standard
white-space characters.
hmm, anyone with a small skill in computers could put those two together
and figure it out. but perl is not for morons like you! it requires a
functioning neuron or two. vb is around the corner over there -->. enjoy
it.
uri
--
Uri Guttman ------ uri@stemsystems.com -------- http://www.stemsystems.com
--Perl Consulting, Stem Development, Systems Architecture, Design and Coding-
Search or Offer Perl Jobs ---------------------------- http://jobs.perl.org
------------------------------
Date: Mon, 12 Apr 2004 06:01:07 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: perldoc incompetence: perlre /s
Message-Id: <pan.2004.04.12.04.00.47.724248@aursand.no>
On Sun, 11 Apr 2004 19:59:03 -0700, Xah Lee wrote:
> today i'm writing some perl code involving regex. I wanted to find out
> exactly what is /s (whitespace) is defined.
When did /s become - or represent - whitespace?
--
Tore Aursand <tore@aursand.no>
"To cease smoking is the easiset thing I ever did. I ought to know,
I've done it a thousand times." -- Mark Twain
------------------------------
Date: Mon, 12 Apr 2004 05:43:09 GMT
From: Ala Qumsieh <xxala_qumsiehxx@xxyahooxx.com>
Subject: Re: perldoc incompetence: perlre /s
Message-Id: <N%pec.36026$Xg.19409@newssvr29.news.prodigy.com>
[I usually don't reply to such posts, but I'll make an exception this time]
Xah Lee wrote:
> today i'm writing some perl code involving regex. I wanted to find out
> exactly what is /s (whitespace) is defined. So i did "perldoc -t
> perlre".
I remember your posts from when I used to frequent this newsgroup 5 or
so years ago. They have always been anti-Perl, always boasting at how
other languages are superior to Perl, and how you can't stand its
syntax, and never showing a real grasp on its constructs. Not much has
changed I see.
It's simply amazing that after all of this time you can't figure out the
difference between \s and /s in regexps, even when your perldoc command
conveniently displays the answer right in front of you. Don't blame Perl
for your incompetence and lack of will to read some documentation. You
two are not meant to be together. Just let it be, and move along.
> Fucking no mention of it. Fuck Perl and fuck Perl coders.
I see that after so many long, ill-written posts of derogatory anti-Perl
comments that didn't do much, you resort to name calling and filthy
language.
Please take your dirty laundry elsewhere. If you don't like Perl, then
*PLEASE* don't use it. Adopt any of the myriad other languages out
there, and post to their newsgroups.
--Ala
------------------------------
Date: Sun, 11 Apr 2004 12:30:43 -0700
From: "Neil Bradley" <nb_no_spam@synthcom.com>
Subject: Problem building Perl 5.8.3
Message-Id: <107j76sg94ltj0d@corp.supernews.com>
I'm attempting to build Perl 5.8.3 on FreeBSD 4.7-STABLE in threaded mode
(I'm attempting to do greylisting and Perl needs to be compiled with
threading and interpretive modes enabled), and when I enable threading and
interpretive threads I get this when I build:
CCCMD =
cc -DPERL_CORE -c -DHAS_FPSETMASK -DHAS_FLOATINGPOINT_H -fno-strict-aliasing
-I/usr/local/include -O -Wall
rm -f opmini.c
cc -Wl,-E -L/usr/local/lib -o miniperl miniperlmain.o opmini.o
libperl.a -lm -lcrypt -lutil -lc
miniperlmain.o: In function `main':
miniperlmain.o(.text+0xbf): undefined reference to `pthread_mutex_destroy'
opmini.o: In function `Perl_op_free':
opmini.o(.text+0x3bb): undefined reference to `pthread_mutex_lock'
opmini.o(.text+0x3e2): undefined reference to `pthread_mutex_unlock'
opmini.o(.text+0x409): undefined reference to `pthread_mutex_unlock'
opmini.o: In function `Perl_scalar':
opmini.o(.text+0xb46): undefined reference to `pthread_getspecific'
opmini.o: In function `Perl_list':
opmini.o(.text+0x11a2): undefined reference to `pthread_getspecific'
opmini.o: In function `Perl_load_module_nocontext':
opmini.o(.text+0x5228): undefined reference to `pthread_getspecific'
libperl.a(perl.o): In function `perl_alloc':
perl.o(.text+0x38): undefined reference to `pthread_key_create'
perl.o(.text+0x77): undefined reference to `pthread_setspecific'
perl.o(.text+0x9b): undefined reference to `pthread_mutex_init'
perl.o(.text+0xbf): undefined reference to `pthread_mutex_init'
perl.o(.text+0xe3): undefined reference to `pthread_setspecific'
libperl.a(util.o): In function `Perl_safesysmalloc':
util.o(.text+0x15): undefined reference to `pthread_getspecific'
libperl.a(util.o): In function `Perl_safesysrealloc':
util.o(.text+0xc1): undefined reference to `pthread_getspecific'
libperl.a(util.o): In function `Perl_safesyscalloc':
util.o(.text+0x1a1): undefined reference to `pthread_getspecific'
libperl.a(util.o): In function `Perl_form_nocontext':
util.o(.text+0xd30): undefined reference to `pthread_getspecific'
libperl.a(util.o): In function `Perl_mess_nocontext':
util.o(.text+0xdd8): undefined reference to `pthread_getspecific'
libperl.a(util.o)(.text+0x1798): more undefined references to
`pthread_getspecific' follow
.....
Obviously I'm missing a library somewhere. Any idea what this means or how I
can fix it? Thanks!
-->Neil
------------------------------
Date: 11 Apr 2004 23:51:44 -0700
From: anatase@cablespeed.com (Anatase)
Subject: regex not matching high end
Message-Id: <fed0f24a.0404112251.1ce3e68c@posting.google.com>
if(!($input2 =~ /[a-zA-Z]{4,12}/))
{
print "try the input again\n";
Usernamesub();
}
aaa - does not match so steps in
aaaa - match so steps past
aaaaaaaaaaaaa - 13+ should step in - but instead steps past
I'm using active states perl 5.8 it seems.
------------------------------
Date: Sun, 11 Apr 2004 20:22:49 +0000 (UTC)
From: J Krugman <jkrugman@yahbitoo.com>
Subject: Re: Returning multiple values
Message-Id: <c5c9ep$alj$1@reader1.panix.com>
In <Pine.SGI.3.96.1040411104502.183234B-100000@vcmr-64.server.rpi.edu> Jeff 'japhy' Pinyan <pinyaj@rpi.edu> writes:
>[posted & mailed]
>On Sun, 11 Apr 2004, J Krugman wrote:
>>In <4078A144.7050107@rochester.rr.com> Bob Walton <invalid-email@rochester.rr.com> writes:
>>
>>>Try:
>>>
>>> my $n=()=foo();
>>
>>OK, but what does it mean? What does perl do when it executes the
>Briefly put, there are a few things you need to know here. First, that
>assignment works right-to-left, so
> my $n = () = foo();
>is, precedence-wise:
> my $n = ( () = foo() );
>Second, you need to know that list-assignment:
> @a = foo();
> ($b, $c) = foo();
> ($d) = foo();
> # and even
> () = foo();
>will, in scalar context, return the number of values found on the
>right-hand side of the assignment. Thus, if foo() returns 10 values, then
> $x = @a = foo();
> $x = ($b, $c) = foo();
> $x = ($d) = foo();
> $x = () = foo();
>all store 10 in $x, regardless of how many variables are being given
>values from foo()'s return list.
>And as an exercise to the reader, what do you expect
> $a = ($b,$c) = ($d,$e,$f) = ('a' .. 'z');
>to store in each of those variables? Remember precedence:
> $a = (
> ($b,$c) = (
> ($d,$e,$f) = ('a' .. 'z')
> )
> );
>(And also note that a list assignment in list context merely returns the
>left-hand side, NOT the right-hand side.)
Thank you, that was very clear and helpful.
jill
--
To s&e^n]d me m~a}i]l r%e*m?o\v[e bit from my a|d)d:r{e:s]s.
------------------------------
Date: Sun, 11 Apr 2004 23:37:47 GMT
From: Bob Walton <invalid-email@rochester.rr.com>
Subject: Re: Returning multiple values
Message-Id: <4079D5EE.2030209@rochester.rr.com>
J Krugman wrote:
> In <4078C7FD.2070404@rochester.rr.com> Bob Walton <invalid-email@rochester.rr.com> writes:
...
> Thanks. I've discovered that my perldata page is damaged goods:
> ...
>
> It is not that old either (2003-09-11). This is unsettling.
>
> jill
Interesting. Mine is older than that (3/31/03). It's from:
This is perl, v5.8.0 built for MSWin32-x86-multi-thread
(with 1 registered patch, see perl -V for more detail)
Copyright 1987-2002, Larry Wall
Binary build 806 provided by ActiveState Corp. http://www.ActiveState.com
Built 00:45:44 Mar 31 2003
--
Bob Walton
Email: http://bwalton.com/cgi-bin/emailbob.pl
------------------------------
Date: Mon, 12 Apr 2004 03:12:00 GMT
From: "Danny" <dannywork5@hotmail.com>
Subject: What about this script? HTML::Parser
Message-Id: <4Onec.386$467.65654@news4.srv.hcvlny.cv.net>
Thanks Bob for getting me started.
Here is a bit of code. This works and prints out the text of an HTML doc.
How can I modify this so I can see the tags too. I tried some examples, but
could not get it to work.
I would like to extract the skunumber out too in these kinds of statemens in
the index.html
<INPUT type=hidden value=item34443 name=skunumber>
Here is code:
---------------------------
#!/usr/bin/perl -w
package Example;
use strict;
require HTML::Parser;
@Example::ISA = qw(HTML::Parser);
my $parser = Example->new;
$parser->parse_file('index.html');
print $parser->{TEXT};
sub text
{
my ($self,$text) = @_;
$self->{TEXT} .= $text;
}
------------------------------
Date: Mon, 12 Apr 2004 02:55:36 GMT
From: Tigerhillside <Tigerhillsideremove@removenetscape.net>
Subject: Why doesn't this UserAgent script work?
Message-Id: <1v0k701c8uoldtse9h0f5kc4c420enq8lt@4ax.com>
I am having a problem with making a simple UserAgent script work.
It works just find, with strict and warnings, from the command
line, has the right permissions, does not depend on local
environment rights, etc. The real script does more but I stripped
it down to a frequent example and I still can't get it to work
when called from a browser.
Here is the script:
#!/usr/bin/perl -w
use strict;
require LWP::UserAgent;
my $ua = LWP::UserAgent->new;
my $request = HTTP::Request->new('GET', 'http://www.yahoo.com');
my $response = $ua->request($request);
if ($res->is_success) {
print $res->content;
} else {
print $res->status_line, "\n";
}
I get the "Internal Server Error" response. This part should be
easy but it is not.
(I tried comp.infosystems.www.authoring.cgi as well, I don't know
if this is a Perl question or CGI.)
------------------------------
Date: 12 Apr 2004 03:50:02 GMT
From: Dave O Connor <doc@CONSORTIUM.RedBrick.DCU.IE.small.carrots>
Subject: Re: Why doesn't this UserAgent script work?
Message-Id: <slrnc7k4fa.sae.doc@carbon.redbrick.dcu.ie>
Tigerhillside said this:
> I am having a problem with making a simple UserAgent script work.
> It works just find, with strict and warnings, from the command
> line, has the right permissions, does not depend on local
> environment rights, etc. The real script does more but I stripped
> it down to a frequent example and I still can't get it to work
> when called from a browser.
>
> Here is the script:
>
>#!/usr/bin/perl -w
>
> use strict;
>
> require LWP::UserAgent;
> my $ua = LWP::UserAgent->new;
> my $request = HTTP::Request->new('GET', 'http://www.yahoo.com');
> my $response = $ua->request($request);
>
> if ($res->is_success) {
> print $res->content;
Here's your problem. You're printing the content as shown by the browser (in
this case, the virtual UserAgent browser). However, you need to output some
headers first. At the bare minimum, you could go:
print "Content-type:\ttext/html\n\n";
before printing out this content. Alternatively, CGI->header() returns the
same.
- DoC
------------------------------
Date: Mon, 12 Apr 2004 06:01:07 +0200
From: Tore Aursand <tore@aursand.no>
Subject: Re: Why doesn't this UserAgent script work?
Message-Id: <pan.2004.04.12.03.58.36.277476@aursand.no>
On Mon, 12 Apr 2004 02:55:36 +0000, Tigerhillside wrote:
> It works just find, with strict and warnings, from the command
> line [...]
No it doesn't, and it shouldn't. Your script has syntax errors in it,
which _might_ be because you didn't copy & paste the code but rewrote it,
which is a very bad thing to do.
> #!/usr/bin/perl -w
> use strict;
> require LWP::UserAgent;
Should - or could - be:
#!/usr/bin/perl
#
use strict;
use warnings;
use LWP::UserAgent;
> my $ua = LWP::UserAgent->new;
> my $request = HTTP::Request->new('GET', 'http://www.yahoo.com');
> my $response = $ua->request($request);
>
> if ($res->is_success) {
> print $res->content;
> } else {
> print $res->status_line, "\n";
> }
Here's the syntax error; Where is $res created/defined? Never. You
probably meant $response, though.
> I get the "Internal Server Error" response. This part should be
> easy but it is not.
It's the web server which complains - not Perl. Looking at your script,
it happens probably because you're not sending the web server the correct
http headers;
print "Content-type: text/html\n\n";
if ( $response->is_success() ) {
print $response->content();
}
else {
print $response->status_line();
}
You should also take a look at the CGI module, and - of course - consult
the Perl FAQ.
--
Tore Aursand <tore@aursand.no>
"There are three kinds of lies: lies, damn lies, and statistics." --
Benjamin Disraeli
------------------------------
Date: Mon, 12 Apr 2004 04:23:05 GMT
From: Tigerhillside <Tigerhillsideremove@removenetscape.net>
Subject: Re: Why doesn't this UserAgent script work?
Message-Id: <735k70tnfbeo4c0ci20mf2i610ge2d9tkt@4ax.com>
In comp.lang.perl.misc, Dave O Connor
<doc@CONSORTIUM.RedBrick.DCU.IE.small.carrots>, I read and
responded
>Tigerhillside said this:
>> I am having a problem with making a simple UserAgent script work.
>> It works just find, with strict and warnings, from the command
>> line, has the right permissions, does not depend on local
>> environment rights, etc. The real script does more but I stripped
>> it down to a frequent example and I still can't get it to work
>> when called from a browser.
>>
>> Here is the script:
>>
>>#!/usr/bin/perl -w
>>
>> use strict;
>>
>> require LWP::UserAgent;
>> my $ua = LWP::UserAgent->new;
>> my $request = HTTP::Request->new('GET', 'http://www.yahoo.com');
>> my $response = $ua->request($request);
>>
>> if ($res->is_success) {
>> print $res->content;
>
>Here's your problem. You're printing the content as shown by the browser (in
>this case, the virtual UserAgent browser). However, you need to output some
>headers first. At the bare minimum, you could go:
>
>print "Content-type:\ttext/html\n\n";
>
>before printing out this content. Alternatively, CGI->header() returns the
>same.
I had thought of that, but thought that the other page gave me
them. I should have just tested it out, but the thought flashed
through my tiny brain before I could work with it. Thanks.
------------------------------
Date: Mon, 12 Apr 2004 04:52:01 GMT
From: Tigerhillside <Tigerhillsideremove@removenetscape.net>
Subject: Re: Why doesn't this UserAgent script work?
Message-Id: <nq7k70pomt6fq9n1mcqjn94uadh85kj2ac@4ax.com>
In comp.lang.perl.misc, Tore Aursand <tore@aursand.no>, I read
and responded
>On Mon, 12 Apr 2004 02:55:36 +0000, Tigerhillside wrote:
>> It works just find, with strict and warnings, from the command
>> line [...]
>
>No it doesn't, and it shouldn't. Your script has syntax errors in it,
>which _might_ be because you didn't copy & paste the code but rewrote it,
>which is a very bad thing to do.
Some of both, but thanks. It is late here and I am trying to go
to sleep. That said, thanks.
>> #!/usr/bin/perl -w
>> use strict;
>> require LWP::UserAgent;
>
>Should - or could - be:
>
> #!/usr/bin/perl
> #
Is that needed? If so, could you explain, I have not come across
it before. (I am old to programming, new to Perl, and having
troubling adapting. All good things come in time, or something
like that.)
> use strict;
> use warnings;
Sorry, but is that better than '-w'? I will use it from now on
but thought either worked.
> use LWP::UserAgent;
>> my $ua = LWP::UserAgent->new;
>> my $request = HTTP::Request->new('GET', 'http://www.yahoo.com');
>> my $response = $ua->request($request);
>>
>> if ($res->is_success) {
>> print $res->content;
>> } else {
>> print $res->status_line, "\n";
>> }
>
>Here's the syntax error; Where is $res created/defined? Never. You
>probably meant $response, though.
Yeah, I mixed two scripts to post. Sorry and you are right, I
should always test the script I am going to post.
>> I get the "Internal Server Error" response. This part should be
>> easy but it is not.
>
>It's the web server which complains - not Perl. Looking at your script,
>it happens probably because you're not sending the web server the correct
>http headers;
>
> print "Content-type: text/html\n\n";
> if ( $response->is_success() ) {
> print $response->content();
> }
> else {
> print $response->status_line();
> }
>
>You should also take a look at the CGI module, and - of course - consult
>the Perl FAQ.
I have and had the correct CGI stuff at one point. But I had a
different error and in trying to make a small test script I
somehow tossed the wrong things. Then, as I said in my other
response, somehow thought that the headers were taken care of by
the called site. I know that is wrong, but it was just right
enough to confuse a tired and ignorant person. But thanks.
------------------------------
Date: 6 Apr 2001 21:33:47 GMT (Last modified)
From: Perl-Users-Request@ruby.oce.orst.edu (Perl-Users-Digest Admin)
Subject: Digest Administrivia (Last modified: 6 Apr 01)
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: due to the current flood of worm email banging on ruby, the smtp
server on ruby has been shut off until further notice.
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 V10 Issue 6387
***************************************