I'm trying to get a very simple Perl CGI script working that uses LWP::Simple. There are various examples of what I want to do around the web, but they all pretty much boil down to this:
use LWP::Simple;
print "Content-type: text/html\n\n";
getprint ('http://myothersite.com');
print "Hello\n";
exit; This works fine from a shell, but returns a 500 in a browser. Normally, this would have something to do with the content type, but the 'use LWP::Simple' line seems to be the one triggering the error. That is, when that line is commented out, the script runs fine (minus retrieving the URL, of course).
Any ideas?
Many thanks.
You don't mention it, but does your script have the shebang line in it? This is the line that starts your script file and looks like this:
#!/usr/bin/perl
That should contain the location to perl on your system.
Other things to check: your apache log file may give you some insight to the error. Also check the permissions on the file, is it 755?
Hope that helps.
LisaB
What I don't understand, then, is why running the script from command line not only fails to throw out the "can't find it" error, but it also actually executes what it needs to. Does a script invoked from a browser get a different @INC than otherwise?
Edit: Benny, I just realized you already mentioned checking to see what's available in the CGI environment, so I guess the answer to my question is, "yes", and that's what I need to do about it.
Thanks.