Beefy Boxes and Bandwidth Generously Provided by pair Networks
Just another Perl shrine
 
PerlMonks  

Re: WWW::Mechanize and connection errors

by saberworks (Curate)
on Oct 12, 2009 at 16:50 UTC ( #800747=note: print w/ replies, xml ) Need Help??


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(); }


Comment on Re: WWW::Mechanize and connection errors
Download Code

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://800747]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (14)
As of 2015-07-31 12:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    The top three priorities of my open tasks are (in descending order of likelihood to be worked on) ...









    Results (277 votes), past polls