[Catalyst] How to use dbh in the model

Peter Karman peter at peknet.com
Tue Jan 29 14:25:06 GMT 2008



On 01/29/2008 05:29 AM, Richard Jones wrote:

> 
> package MyApp::Model::DBI;
> 
> __PACKAGE__->config(
>   dbi => DBIx::Simple->new(__PACKAGE__->dbh),
> );
> 
> but obviously not:
> Can't use string ("MyApp::Model::DBI") as a HASH ref while "strict refs"
> in use at /usr/local/share/perl/5.8.7/Class/Accessor/Fast.pm line 38.
> 
> MyApp::Model::DBI connect_info is automatically loaded from the global
> config file. I need to get the models dbh into DBIx::Simple->new(). What
> am I doing wrong?

override new() instead? See the Catalyst::Component docs.
-- 
Peter Karman  .  peter at peknet.com  .  http://peknet.com/




More information about the Catalyst mailing list