Robust Handling of Broken Links in Mechanize?by pat_mc (Pilgrim)
|on Nov 20, 2009 at 09:58 UTC||Need Help??|
pat_mc has asked for the
wisdom of the Perl Monks concerning the following question:
Esteemed Monks -
I am currently writing a simple script based on the Mechnize module to download a bunch of PDFs from a website. The problem I am encountering is that the site seems to contain a link which points to a document that is unavailable on the server. As a result, the GET method returns the following error:
Error GETing <URL>: Not Found at extract.pl line 86
I have tried to incorporate robust handling of such error messages like this:
Unfortunately, the script still aborts as soon as the broken link is encountered.
Can you please advise how I can modify my code in order for the script to continue downloading even when broken links are hit upon?
Thanks in advance and best regards -