[Catalyst] More complex Class::DBI::Sweet usage?

Toby Corkindale tjc at wintrmute.net
Fri Jul 1 13:06:31 CEST 2005

On Fri, Jul 01, 2005 at 12:59:13PM +0200, Danijel Milicevic wrote:
> Am Freitag, den 01.07.2005, 11:22 +0100 schrieb Toby Corkindale:
> > Ah, but this doesn't quite work for me - it seems like the CDBI functions
> > don't yet exist at the time the set_sql() routines are called, ie:
> ...
> > But the next line shows us failing when the Stores.pm package is loaded:
> > [Fri Jul 01 11:16:41 2005] [error] [client] Couldn't load
> > "DieselCatalyst::M::CDBI::Stores", "Can't locate object method "set_sql" via
> > package "DieselCatalyst::Model::CDBI::Stores" at
> > /home/tobyc/svn/DieselCatalyst/lib/DieselCatalyst/M/CDBI/Stores.pm line 11.
> > 
> > If I remove the offending set_sql() statement, then we load alright, and
> > amidst the debug messages is this line, where C::M::CDBI tells us it has
> > automatically created the appropriate class magically:
> > [Fri Jul 01 11:20:17 2005] [error] [client] | DieselCatalyst::M::CDBI::Stores   
> Something is definetly wrong here, since all your debug output is
> prefixed with [error].
> What does your DieselCatalyst::M::CDBI.pm look like? It should be
> something like:
> package MyApp::M::CDBI;
> use strict;
> use base 'Catalyst::Model::CDBI';

This is where the confusion occured - since everything uses Catalyst::Model::*
I figured I should be naming my packages under the "Model" namespace, rather
than the "M" namespace. I knew aliases existed so you can access things via
either method, but I figured that the actual packages themselves should be
"model" and the "m" version was the alias - not the other way round!

It seems to be working now though,

Turning and turning in the widening gyre/The falcon cannot hear the falconer;
Things fall apart, the centre cannot hold/Mere anarchy is loosed upon the world
(gpg --keyserver www.co.uk.pgp.net --recv-key 897E5FF3)

More information about the Catalyst mailing list