sub grab_page_content { my ($url, $method, $timeout) = @_; use Sys::SigAction qw( timeout_call ); our $res = undef; if( timeout_call( 5, sub {$res = $ua->get($url);}) ) { $res = HTTP::Response->new( 408 ); #408 is the HTTP timeout } my $page_content = $res->content if $res->is_success; #For phpld directories, if script error, the page will not output html tags $page_content = 0 if $page_content !~ m{