in reply to Check if URL exists

Sivel, From within LWP::Simple you can still use other LWP methods, just import the useragent object for this purpose.

So in your example to set a timeout of 10:

use LWP::Simple qw($ua head); $ua->timeout(10); my $url = 'http://www.domain.com/'; if (head($url)) { print "Does exist\n"; } else { print "Does not exist or timeout\n";; }

NB: LWP::Simple's head() and get() functions do not distinguish between 'not exists' and 'timeout', it returns similar for both situations.

Replies are listed 'Best First'.
Re^2: Check if URL exists
by sivel (Initiate) on Jun 04, 2007 at 17:50 UTC
    This (importing the useragent object) worked perfectly. I wasn't sure I needed to know if it was a timeout or non-existent page...I decided I did and implemented an easy setting a variable for start time and one for end and doing subtraction.

    Thanks again!