NAME
Class::DBI::Plugin::Connection - apply for Apache::DBI in mod_perl environment
SYNOPSIS
package CD;
use base qw(Class::DBI);
use Class::DBI::Plugin::Connection;
# then connection type is automatically selected.
# use DBI::connect instead of DBI::connect_chached
# in mod_perl environment.
# or you can force to set.
__PACKAGE__->connection_caching(1);
# now CDBI connects to database with selected proper method.
__PACKAGE__->set_db(...);
DESCRIPTION
This module handles CDBI app's connection type.
CDBI makes connection with DBI::connect_cached to decrease connection costs. This is better most of the time.
But when you want to use CDBI in mod_perl environment, Maybe you want to use Apache::DBI for persistent connection. Apache::DBI doesn't support connect_cached.
As the solution for this problem, you can use this module.
PROPERTY
- connection_caching
-
All you have to do is to write 'use Class::DBI::Plugin::Connection;', and proper connection method will be selected automatically. But if there are times when you want to choose connection type yourself, set this property.
__PACKAGE__->connection_caching(0); # connect with DBI->connect(...) __PACKAGE__->connection_caching(1); # connect with DBI->connect_cached(...)
AUTHOR
Lyo Kato <kato@lost-season.jp>
SEE ALSO
COPYRIGHT AND LICENSE
Copyright 2005 by Lyo Kato.
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself.