Re: Alarm Function and LWP::Simple

Martijn Koster (mak@webcrawler.com)
Fri, 9 Jan 1998 04:17:49 +0000


On Thu, Jan 08, 1998 at 05:47:30PM -0700, Eric Pan wrote:

> I have the following code that uses the alarm function. The program should
> end if the responds from the web server is more than 10 seconds. However, it
> timeouts at 180 seconds when there's no respond.
> 
> Do you know why?
...
>      alarm 10;
>      $content = get('http://www.test.com/');

perldoc LWP::UserAgent:

          By default the library uses alarm() to implement timeouts,
          dying if the timeout occurs...

	...

          $ua->timeout([$secs])
              Get/set the timeout value in seconds. The default
              timeout() value is 180 seconds, i.e. 3 minutes.


so when LWP does an alarm(180), that replaces your alarm 10.

-- Martijn Koster, m.koster@pobox.com