I have a program design question for the monks today.
I'm working on a web-spidering application using Win32::IE::Mechanize to do the spidering and HTML::Treebuilder to extract information. I'm running into difficulty dealing with intermittent network issues -- sometimes for a few seconds I can't reach the remote site, or the site is unresponsive, or something else impedes the flow of the program.
This is, as we all know, a fact of life on the internet. But at the minute, if my program doesn't find the piece of information it's looking for on the page it thinks it loaded, it dies.
Now part of the problem is that I'm not checking for errors robustly enough. I'm about to put just such error checking in.
But another part of the problem is that I'd like to be able to catch such a failure and retry a couple of times before finally giving up. I'm having trouble coming up with an elegant architecture for doing this, and I would love some advice from some the rest of you wise monks on how to do this nicely. The ideal solution would also be abstract enough to use easily with multiple sequences of actions -- I have a couple of different programs that all face the same issue.
Thanks very much for your meditation on my difficulty.
In reply to catching failures and retrying by mickey
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |