Class::DBI::Plugin::Connection - apply for Apache::DBI in mod_perl environment
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(...);
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.
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(...)
Lyo Kato <kato@lost-season.jp>
Class::DBI, Apache::DBI
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.
To install Class::DBI::Plugin::Connection, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Class::DBI::Plugin::Connection
CPAN shell
perl -MCPAN -e shell install Class::DBI::Plugin::Connection
For more information on module installation, please visit the detailed CPAN module installation guide.