Catalyst::TraitFor::Model::DBIC::Schema::ConnectInfo::Several - support for several connect_info entries.
connect_info
Version is 0.05
package MyApp::Model::DB; use Moose; use namespace::autoclean; extends 'Catalyst::Model::DBIC::Schema'; __PACKAGE__->config( { traits => ['ConnectInfo::Several'], schema_class => 'MyApp::Schema', active_connection => 'mysql_devel', connections => { mysql_devel => [ 'dbi:mysql:db_devel', 'user1', 'pass1' ], mysql_production => [ 'dbi:mysql:db_prod', 'user2', 'pass2' ], }, } ); # # or in application config # <Model::DB> traits ConnectInfo::Several active_connection mysql_devel <connections> <mysql_devel> dns dbi:mysql:db_devel user user1 password pass1 </mysql_devel> <mysql_prod> dns dbi:mysql:db_prod user user2 password pass2 </mysql_prod> </connections> </Model::DB>
You can define several connections in connections hash, and select which one should be used currently via active_connection. You shouldn't define connect_info - it will be set for you, depending on what you set in active_connection and connections.
connections
active_connection
This trait will do something only if you set active_connection, otherwise it just do nothing, like it was not used at all.
Write tests.
Catalyst::Model::DBIC::Schema, DBIx::Class, Catalyst
Report bugs or feature requests
L<http://rt.cpan.org/NoAuth/ReportBug.html?Queue=Catalyst-TraitFor-Model-DBIC-Schema-ConnectInfo-Several>
Git repository
git clone git://github.com/cub-uanic/Catalyst-TraitFor-Model-DBIC-Schema-ConnectInfo-Several.git
Oleg Kostyuk, <cub#cpan.org>
<cub#cpan.org>
Matt S. Trout <mst#shadowcatsystems.co.uk>
<mst#shadowcatsystems.co.uk>
Copyright 2009 Oleg Kostyuk.
This program is free software; you can redistribute it and/or modify it under the terms of either: the GNU General Public License as published by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
To install Catalyst::TraitFor::Model::DBIC::Schema::ConnectInfo::Several, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Catalyst::TraitFor::Model::DBIC::Schema::ConnectInfo::Several
CPAN shell
perl -MCPAN -e shell install Catalyst::TraitFor::Model::DBIC::Schema::ConnectInfo::Several
For more information on module installation, please visit the detailed CPAN module installation guide.