Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

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:

my $ua = LWP::Protocol::https::Socket->new( PeerAddr => '', PeerPort => 443, Proto => 'tcp', Timeout => 180, KeepAlive => '', SendTE => 1 );

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!

In reply to Odd effects of mod_perl on IO::Socket or LWP::Protocol? by ehdonhon

Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":

  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?

What's my password?
Create A New User
Domain Nodelet?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (2)
As of 2023-06-05 09:33 GMT
Find Nodes?
    Voting Booth?
    How often do you go to conferences?

    Results (24 votes). Check out past polls.