[Catalyst] do I need to load Apache::DBI?

Perrin Harkins perrin at elem.com
Mon Jul 30 23:19:09 GMT 2007


On 7/30/07, Matt S Trout <dbix-class at trout.me.uk> wrote:
> I used to consider it a neat hack. After some time with the internals,
> some fun explicitly disabling it within DBIC since it sometimes broke our
> reconnect code, and even then discovering I could often solve client mod_perl
> problems by removing the line that loaded it from httpd.conf, I reclassified
> it was 'awful'.

Your implication is that Apache::DBI doesn't work, as opposed to
simply clashing with some of the DBIC code that tries to manage the
same connections.  It works just fine.  It's widely-used and does what
it was intended to without known bugs.

Apache::DBI provides an important service for people trying to port
CGI code to mod_perl, by both making their connections persistent and
fixing the most common mistakes in homegrown persistent connections
(accidental copying across forks, ping check after inactivity, auto
cleanup after crashed requests).

The implementation is sneakier than I normally like to see because not
requiring client code changes is one of its design goals.  For that
reason, I wouldn't recommend it to people who are starting fresh with
a new codebase and are able to write it specifically for a persistent
environment like mod_perl.  Most of them will use another tool that
already handles connection persistence, like an ORM.

If someone out there wants to use DBIC (or another tool that manages
its own connections) in the same process as some code that needs
Apache::DBI, they should feel free to ask for help on the mod_perl
list.  I don't think it would be a hard problem to fix.

- Perrin



More information about the Catalyst mailing list