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:
in reply to WWW::Mechanize and connection errors
my $response = $mech->get($url);
# do your stuff
# grab the status?
warn "Unable to connect: " . $response->status_line();