GET works, but not from user httpd
Bill Moninger (moninger@fsl.noaa.gov)
Sat, 17 Feb 96 19:29:54 GMT
When I run the following routine as a regular unix user, it works fine.
But when I call it from the web (as user httpd) it fails. I am (now)
running perl 5.001m with SunOS.
Here is some error information is from some print statements I added to
Protocol.pm:
=========Error information vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv
results of 'require LWP/Protocol/http.pm' in Protocol.pm is:
Can't locate 5 in @INC at
/usr/local/perl5/lib/perl5/FileHandle.pm line 54.
BEGIN failed--compilation aborted at
/libwww-perl-5b6/lib/LWP/Protocol/http.pm line 14.
Protocol scheme 'http' is not supported at
/libwww-perl-5b6/lib/LWP/UserAgent.pm line 215
============================================================
(it is bombing on the 'require 5.000' statement in FileHandle.pm, but only
when run by httpd--it works fine when run by me directly)
============Calling routine vvvvvvvvvvvvvvvvvvvvvvvv
sub badURL {
print "intp badURL<br>\n";
use LWP::UserAgent;
use HTTP::Request;
use HTTP::Response;
my @URLs = @_;
my @bads=();
foreach $URL (@URLs) {
if ($URL) {
print "URL is $URL<br>\n";
my $ua = new LWP::UserAgent;
my $request = new HTTP::Request('GET',$URL );
my $response = $ua->request($request);
if ($response->isError) {
my $msg= $response->asString;
$msg =~ /Message: (.*)\n/;
push (@bads,$1);
}
}
}
if(@bads) {
print "The following URL(s) apparently have errors:<br>\n";
foreach $bad (@bads) {
print "$bad<br>\n";
}
return 1;
}
return 0; # return number of bad URL's
}
I shall appreciate any help anyone can provide. (And thank you all very
much for previous help.)
-Bill
-------------------------
William R. Moninger, Nat'l Oceanic & Atmospheric Administration (NOAA)
Forecast Systems Laboratory, R/E/FS1
325 Broadway; Boulder, CO 80303; USA
moninger@fsl.noaa.gov; Voice: 303-497-6435; Fax: 303-497-3329
URL: http://www.fsl.noaa.gov/frd-bin/bill.homepage.cgi