Hiya,

I just started running some CGI scripts.  Very cool.  But I'm running into a
problem both with an example in the CookBook and with a script given to me.
Both use LWP so I'm thinking that I'm missing a module or something.  I have
the basic Active State install loaded on a WinNT book.  I see a LWP folder
under Perl\site\lib. 

The script (> >see below) given to me seems to be returning bad data:
<head><title>Error in CGI Application</title></head>
<body><h1>CGI Error</h1>The specified CGI application misbehaved by not
returning a complete set of HTTP headers.  The headers it did return
are:<p><p><pre></pre>

The example from the book "times out" each time I run it.  Here it is:

perl -MLWP::Simple -e "getprint 'http://www.perl.org/press/fast_facts.html'"

Any clues as the problem would be much appreciated.

Script notes:

> >Bruno,
> >   I used CGI and LWP::Simple to get ESPN's AL East baseball standings
table
> >and then rewrite that table into a format that I wanted. You can see it
at
> >http://jasper.cs.yale.edu if you're curious (insert shameless plug for
the Red
> >Sox here). But that sort of thing might help you to grab the source for
an
> >HTML page. Here's the snippet that's the critical part, and if you want
my
> >whole script, let me know and I'll send it to you.
> >
> >#!/usr/bin/perl
> >
> >use CGI;
> >use LWP::Simple;
> >use strict;
> >
> >open OUTFILE, ">/var/www/html/baseball.html";
> >my $content = get("http://sports.espn.go.com/mlb/standings";);
> >my @lines=split(/\n/,$content);
> >
> >Obviously it may not be necessary for you to split the content up into an
> >array, but I found it useful for what I was doing.
> >As far as checking to see if a page is available for browsing, you might
just
> >check the contents for any one of <HTML>, <TITLE>, <HEAD>, or <BODY> or
> ><A HREF or <IMG (all case insensitive, of course).  Chances are pretty
high
> >that if a page is live you'll hit one of those on any page. There's gotta
be a
> >better solution, though.
> >
> >        Pete


Reply via email to