http://www.perlmonks.org?node_id=800747


in reply to WWW::Mechanize and connection errors

Other than the goto, what's ugly about it? That's a pretty standard way to test for failure. Mechanize is based on LWP, which provides methods to check for errors (including connection errors). Mechanize has wrapper methods for these as well -- check success(). I don't think that suite of modules ever dies on connection error. You can just:
my $response = $mech->get($url); if($response->is_success()) { # do your stuff } else { # grab the status? warn "Unable to connect: " . $response->status_line(); }