my $mech = WWW::Mechanize->new( autocheck => 0 ); my $res = $mech->get('does.notexist.example'); $res->is_success or print "Uhoh\n"; #### my $mech = WWW::Mechanize->new(); my $connected = eval { $mech->get('does.notexist.example'); 1 }; if (! $connected) { print "Uhoh\n"; }; #### use Try::Tiny; my $mech = WWW::Mechanize->new(); try { $mech->get('does.notexist.example'); } catch { print "Uhoh: $_\n"; };