|There's more than one way to do things|
Odd effects of mod_perl on IO::Socket or LWP::Protocol?by ehdonhon (Curate)
|on Aug 28, 2003 at 04:34 UTC||Need Help??|
ehdonhon has asked for the
wisdom of the Perl Monks concerning the following question:
Greetings monks. After several hours, this one really has me baffled. That is to say, I'll find the answer about three minutes after posting the question. :)
My issue is that I've got a piece of code that behaves differently depending on wether I'm running it from a script on the command line, or wether I'm running it from a cgi on a mod_perl server. My problem is getting LWP::UserAgent to talk to a particular site. I've traced the issue down in the code as far as this particular line:
Whenever I run this from a CGI, I find that $ua contains undef. I also find that $! contains 'No such file or directory'.
However, whenever I run this from a script off the command line (running as the webserver user, so it isn't a permissions issue), it works fine!
My first question is: does anybody know of any weird interactions with perhaps either Net::HTTP or IO::Socket::INET that might make it behave differently depending on which modules are already loaded, or depending on the presence of mod_perl?
My second question: how can I trace exactly where that 'No such file or directory' is coming from? I have a feeling if I can drill down to wherever that error is being generated, I'll find my problem. However, there just doesn't seem to be a real good way to trace it!