Anonymous Monk has asked for the wisdom of the Perl Monks concerning the following question:

I'm pretty knew to perl and I've looked around for awhile, and I cant seem to find a solution to my problem. My problem has to do with LWP::Simple and CGI.PM I wrote a simple script that fetches a webpage then it parses the webpage( to get some information from it. Then I Output this data using CGI.PM. From the command line the script outputs everything perfectly, but when I run it from a browser none of the data I parsed from the webpage makes it in the browser window. Im running this on solaris and apache, it's a university server, I had to install the LWP module privately to my home directory, it wasn't installed on the system. Below is the script it's not very long. Thanks, Keegan

#!/usr/bin/perl # use warning; use CGI; use CGI::Pretty; use strict; use lib qw(/home/001/d/da/dale81/LWP/lib/perl5/site_perl/ /home/001/d/da/dale81/LWP/lib/perl5/site_perl/LWP/); use LWP::Simple; my $fdata = CGI->new(); print $fdata->header; print $fdata->start_html('Weather'); my $zip = 75252; my $url1 = 'http://www.wunderground.com/cgi-bin/findweather/getForecas +t?query='; my $url = $url1.$zip; my $response =get( $url ); my $day01; my $day02; my $day03; my $day04; my $day05; my $fTemp; my $cTemp; #extract 5-day outlook if($response=~/<th(.+)>([a-zA-Z]+)<\/th>(\s)<th(.+)>([a-zA-Z]+)<\/th>( +\s)<th(.+)>([a-zA-Z]+)<\/th>(\s)<th(.+)>([a-zA-Z]+)<\/th>(\s)<th vali +gn=middle class=smalltable width="20%" bgcolor=#DDDDDD>([a-zA-Z]+)<\/ +th>/i) { $day01=$2; $day02=$5; $day03=$8; $day04=$11; $day05=$13; } #output days as headings print $fdata->h1($day01); print br; print $fdata->h1($day02); print br; print $fdata->h1($day03); print br; print $fdata->h1($day04); print br; print $fdata->h1($day05); print br; #extract temp data if($response=~/<nobr><b>([0-9]+)<\/b>&nbsp;&#176\;F<\/nobr>(\s+)\/(\s+ +)<nobr><b>([0-9]+)<\/b>&nbsp\;&#176;C<\/nobr>/i) { $fTemp=$1; $cTemp=$4; } #output temperature print "Temperature F=", $fTemp; print br; print "Temperature C=", $cTemp; print br; print $fdata->end_html;

2004-12-07 Janitored by Arunbear - added readmore tags, as per Monastery guidelines