[Catalyst] connection info and Catalyst::Model::DBIC::Schema

Matt S Trout dbix-class at trout.me.uk
Fri Aug 4 01:06:04 CEST 2006


Alan Humphrey wrote:
> I feel that I'm missing something obvious, but the penny hasn't dropped.
> Hope you all can help.
> 
> Goal: use a DBIx::Class schema defined outside the Catalyst app name space.
> 
> Using: Catalyst::Model::DBIC::Schema
> 
> Problem: I have to define the connection information in my Catalyst
> definition:
> 
> package Engoi::Model::Schema;
> 
> use strict;
> use base 'Catalyst::Model::DBIC::Schema';
> 
> __PACKAGE__->config(
>     schema_class => 'Engoi::Schema::EngoiDbDev',
>     connect_info => [
>         'dbi:Pg:dbname=engoidev',
>         'user',
>         'xxxx',
>         
>     ],
> );
> 
> If I comment out the connection info I get the following error on app
> startup:
> 
> Couldn't instantiate component "Engoi::Model::Schema", "Can't locate object
> method "storage" via package "Engoi::Schema::EngoiDbDev"
> 
> Engoi::Schema::EngoiDbDev look like:
> 
> package Engoi::Schema::EngoiDbDev;
> 
> use strict;
> use warnings;
> use Engoi::Schema::EngoiDb;
> 
> my @conn_info = (
>         'dbi:Pg:dbname=engoidev',
>         'user',
>         'xxxx',
>     { RaiseError => 1, PrintError => 0, ShowErrorStatement => 1, TraceLevel
> => 0 }
> );
> 
> Engoi::Schema::EngoiDb->compose_connection( __PACKAGE__, @conn_info );

compose_connection uses DB.pm which is deprecated and will be removed before 1.0.

You want __PACKAGE__->connection(@conn_info); just subclassing the main schema 
should be sufficient, no?



More information about the Catalyst mailing list