I suspect that the timeout option does not change the HTTP request (as you observe). Instead, perhaps, it sets a timer which returns control to your code if a response has not been received when the timeout expires?

<rummages through docs> aha...yes...it uses 'alarm' to implement timeouts. We're on the right track.

The activestate docs tell us that 'alarm' is not supported in their Win32 port.

A (very) quick look at the LWP::UserAgent.pm code on the Activestate build seem to show that the calls to alarm have been stripped out.

So it seems as though you won't have this functionality in the Win32 port of this module without more effort.

Can anyone confirm this?

In the meantime, off the top of my head I can only think that the way to get his would be:

- run the UserAgent as a sub-process using Win32::Process (this would be quite icky...you still have to pass the result back to your parent)
- use the ->Wait() method on the 'process object' returned, to sleep until your timeout expires or the subprocess exits
- kill the subprocess if the ->Wait returned the code which means "process still running"

For bonus style points, wrap this functionality up in the module so the 'timeout' behaves the same as on UNIX and send a patch to the maintainer. :-)

Hope someone else can come up with a better solution.


In reply to Re: HTTP timeout problems by jbert
in thread HTTP timeout problems by Anonymous Monk

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.