|Perl Monk, Perl Meditation|
Re: LWP::UserAgent connection problem as CGIby tachyon (Chancellor)
|on Mar 03, 2004 at 18:47 UTC||Need Help??|
The error message you see is generated initially by IO::Socket::INET's configure method when it has called its _get_addr() method which has in turn called gethostbyname() which is what will have choked in the first place. (Probably)
To debug write a CGI like this:
Assuming you call it gethost you should see it print 4 binary bytes out as the host name. If it says choked you have an issue with gethostbyname under CGI. If so it will be perms as your CGI will not be running as you.
An alternative way to prove it is perms is
ie change to the user nobody/apache or whatever webserver runs as and see if it chokes. I am making the assumption that you are testing it off the command line *on the same box* that is running the CGI? If not all bets are off!
If gethostbyname is working your IO::Socket::INET has issues. The most probable reason for this is that you have 2 perls on your system. The webserver will probably do
To exec the script and thus use the shebang. Probably. It could be running mod_perl or lots of other stuff but that is the high probability. If you are executing it as perl script.pl then you could quite easily be running it with a different perl to the web server. We have 5.6.1, 5.6.2, 5.8.2 and 5.8.3 on our devel box. perl will currently give you 5.6.2 but...... Let us know your results. div class="pmsig">