Tue Oct 14 00:25:25 BST 2008

Die::Retry - a perl module to easily retry on exceptions

I've just written Die::Retry - a perl module which makes is easy to write a concise exception retry loop.

The module is only useful if any exception can be silently caught and the code in question re-run, but in that case it makes it very easy to write the loop in question:

1    use Die::Retry qw( retry );
2    my $retval = retry( sub { some_func_with_exceptions($param1, $param2) }
3                            , times => 3
4                            , delay => 0
5                            );

In that example the code ref:

1  sub { some_func_with_exceptions($param1, $param2) }</pre>

is called up to three times if exceptions are thrown. There is no delay between retries. Finally - if a successful call is made to the code ref $retval will get the (scalar context) return value of the code ref call.

I'm submitting this to CPAN and have already set it up on GitHub and Ohloh.


Comment by: Bradley Dean at Mon, 20 Oct 2008 22:56:49 (BST)

I've just found Attempt which does exactly what I coded for Die::Retry - in fact both the code and the syntax are practically identical. So dies Die::Retry.


Posted by Bradley Dean | Permalink

Fri Oct 10 17:35:53 BST 2008

Blur "The Best Of" Album Cover - Turkish Rail style

While travelling through Istanbul on the train I happened to notice that their 'make this seat avaialble to folk in need' sticker held a certain resemblance to a Blur album cover:

Blur The Best Of Album Cover Turkish Rail sticker merged with Blur Album

Albeit without the "blur" label! :)


Posted by Bradley Dean | Permalink