| Subcribe via RSS

Perl Module Monday: DBIx::Connector

November 9th, 2009 | 2 Comments | Posted in CPAN, Perl

For this installment of PMM, I would like to venture into the realm of database connectivity and bring some attention on a new player, David Wheeler‘s DBIx::Connector.

What I like most about this is that it scratches a particular itch I often have when writing long-lived DB code: I get tired of always pinging the database through the handle, to make sure the connection is still there before attempting any new operation. On this point alone, DBIx::Connector is worth installing.

Fortunately, that wasn’t the only itch he was scratching, when he wrote it, so it does a lot more than just simplify persistent connections. It’s fork- and thread-safe, handles transactions and save-points (nested, no less), and does it all while letting you choose when/if the database gets pinged, and what happens when the connection is no longer active.

For more explanation and coverage, see David’s post here. He’s also woven it into his Catalyst tutorial, which is tagged here (and made available on GitHub here).

Tags: , , ,