I am planning to write a new module that would manage retries. Let's say you want to talk to some network service that might have errors or be offline, and if you get certain kinds of errors (e.g. the host is being rebooted, so it's not responding, but will shortly) you want to try again after some set interval. But you don't want to retry forever - eventually it should be a hard error.
We already have this kind of logic embedded in one place but I want to write a generic object that would basically hold the retry parameters (RETRY_COUNT, RETRY_DIE, RETRY_SLEEP, RETRY_SLEEP_MULTIPLIER, RETRY_SLEEP_LIMIT) and respond to queries like: - Something failed - should I retry or die? (if number of retries so far is less than RETRY_COUNT) - How long should I sleep for / wake me up when the sleep time has passed - etc. I haven't seen anything on CPAN that does this - a quick search for "retry" on CPAN yields tons of results but they all appear to be very domain-specific or just a mention in the documentation of some particular module. Something like Object::Retry maybe? Then things can inherit from it?