NAME
DBIx::Retry - DBIx::Connector with the ability to retry the run method for a specified amount of time.
VERSION
version 0.004
SYNOPSIS
use DBIx::Retry;
my $conn = DBIx::Retry->new($dsn, $user, $tools, {retry_time => 5});
# all other method are inherited from DBIx::Connector
my $dbh = $conn->dbh; #get a database handle
# Do something with the handle - will retry for specified amount of time, should the database connection be lost
$conn->run(fixup => sub {
$_->do('INSERT INTO foo (name) VALUES (?)', undef, 'Fred' );
});
DESCRIPTION
DBIx::Retry is extended from DBIx::Connector. It adds the ability to keep retrying to connect to a database for a specified amount of time in order to execute DBIx::Connector's run method.
ATTRIBUTES
retry_time
Amount of seconds to retry re-connecting to database, should the database become unavailable.
verbose
Enable verbose output.
METHODS
new
Create a new DBIx::Retry object. my $conn = DBIx::Retry->new($dsn, $user, $tools,{timeout => 5, verbose => 1});
USAGE
Simply create a new DBIx::Retry object:
my $conn = DBIx::Retry->new($dsn, $user, $tools, {retry_time => 5});
Then wrap your operations inside the run method that is inherited from DBIx::Connector:
$conn->run(fixup => sub {
$_->do('INSERT INTO foo (name) VALUES (?)', undef, 'Fred' );
});
Should the connection to the database be lost then DBIx::Retry will retry to connect to the database for the amount of seconds specified in the "retry_time" attribute.
SEE ALSO
DBIx::Connector
AUTHOR
Hartmut Behrens <hartmut.behrens@gmail.com>
COPYRIGHT AND LICENSE
This software is copyright (c) 2012 by Hartmut Behrens.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.