[Catalyst] Model configuration through .yml

Emmanuel Quevillon tuco at pasteur.fr
Wed Jan 13 14:17:22 GMT 2010


Hi,

I'd like to know something, probably a basic problem but just to be sure.
Is it possible to configure Application db connection into .yml 
configuration file like :

Model::MyAppDB
     schema_class: Schema::MyApp
     connect_into:
	- dbi:Pg:dbname=myapp
	- user
	- password
	- options


Actually i tried this way but I cannot connect to the database, neither 
start my application, perl is not able to locate my schema class...!!

Here is the error:

Couldn't load class (Schema::MyApp) because: Couldn't instantiate 
component "BiblioList::Model::MyAppDB", "Can't locate Schema/MyApp.pm in 
@INC

I can make it working if I add into Model::MyApp this :

__PACKAGE__->config( ... );

I first did it, just adding 'schema_class' infos and leaving 
connect_info into config file and it works like a charm.
However, the strange thing is that, other db connection I configured for 
other databases can connect correctly even if I use another Schema 
module like Schema::FooBarDB located under the same directory as 
Schema::MyApp

For example in another confg file I load using 
C::Plugin::ConfigLoader::Multi

I can define this

Model::RemoteDB::AnotherDB:
	schema_class: Schema::FooBarDB
	connect_info:
		- ..

and it connect correctly to my foobardb without throwing errors above.

Is this normal behavior from Catalyst or is there something I am doing 
wrong or just a bug?

Thanks for any hint.

Regards

Emmanuel



More information about the Catalyst mailing list