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


in reply to WWW::Mechanize - error on geting non-existing page

Anonymous Monk,
With current versions of WWW::Mechanize, autocheck is enabled causing $mech to die in these situations. Here is how you might want to handle it:
eval { $mech->get($url); }; if ($@) { if ($mech->status == 404) { # handle page not found } else { die "Mech failed to fetch '$url': $@"; } }

Cheers - L~R