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.
In reply to Re: Check if URL exists
by varian
in thread Check if URL exists
by sivel
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |