Re: Alarm Function and LWP::Simple
Gisle Aas (gisle@aas.no)
10 Jan 1998 12:49:34 +0100
Martijn Koster <mak@webcrawler.com> writes:
> 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.
Also note that the latest development versions (the 5.18_XX series)
does not use alarm() at all. It relies on the IO::Socket::INET
timeouts.
Regards,
Gisle