Microcebus has asked for the wisdom of the Perl Monks concerning the following question:
The problem is, that the program crashes if the link is not found or a link cannot be followed (e.g. an email address returns the error 'can't find sendmail' and exits). How can I prevent the program from crashing?use WWW:Mechanize $website=WWW::Mechanize->new(); $website->get('http://www.website.com'); $link_id=0; while(1) { $link_id++; if($website->follow_link(n=>$link_id)) { do_something(); $website->back(); } else { last; } }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: WWW::Mechanize - Check if link can be followed
by Corion (Patriarch) on Jun 25, 2013 at 07:23 UTC | |
by Microcebus (Beadle) on Jun 25, 2013 at 07:37 UTC | |
by Corion (Patriarch) on Jun 25, 2013 at 07:53 UTC |