Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool
package MyApp::Model::MyDB; use Moose; extends 'Catalyst::Model::DBIC::Schema'; with 'Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool'; sub build_connect_key { my ($self, $c) = @_; return $c->stash->{client}->name; } sub build_connect_info { my ($self, $c) = @_; return $c->stash->{client}->db_connect_info; } 1;
This role handles a pool of connections for your Catalyst::Model::DBIC::Schema model. For each request, your model defines a connection key with "build_connect_key". This role then looks for the storage for that connection and applies it to your model's schema. If no storage has been built previously for this connection key then your model returns the connect_info for it from build_connect_info.
Your model must implmeent both build_connect_key and build_connect_info.
Must return a unique identifier for the schema connection this request should use.
Must return a list of the connect_info for "connection" in DBIx::Class::Schema.
Catalyst::Model::DBIC::Schema DBIx::Class::Schema
Gareth Kirwan, gbjk at cpan.org
gbjk at cpan.org
To install Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool
CPAN shell
perl -MCPAN -e shell install Catalyst::TraitFor::Model::DBIC::Schema::RequestConnectionPool
For more information on module installation, please visit the detailed CPAN module installation guide.