Re: Problems with Macperl 5.6+CGI.PM

[email protected] (Chris Nandor) Sun, 14 Apr 2002 10:58:08 -0400
Newsgroups perl.macperl.webcgi
Organization Pudge.Net
Message-ID <[email protected]>
In article <[email protected]>,
 [email protected] (Ryan Surber) wrote:

> I setup Macperl and ran this script (straight off the
> website).
> 
> #!/usr/bin/perl
> use LWP::Simple;
> 
> my $content = get("http://www.yahoo.com"); #Store the
> output of the web page (html and all) in content
> if (defined $content)
> {
>     #$content will contain the html associated with
> the url mentioned above.
>     print $content;
> }
> else
> {
>     #If an error occurs then $content will not be
> defined.
>     print "Error: Get failed";
> }

I'm confused ... what does this have to do with CGI.pm?


> .... problem is, I can't get more than a few lines
> worth of text from the page.

It works just fine for me.  Maybe it is your ISP's proxy or somesuch.

Note that before printing the content, you should do:

   $content =~ s/\015?\012/\n/g;

To convert LF and CRLF to the Mac OS newline.

-- 
Chris Nandor                      [email protected]    http://pudge.net/
Open Source Development Network    [email protected]     http://osdn.com/