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

Danijel Milicevic Danijel.Milicevic at rawmode.org
Fri Jul 1 12:59:13 CEST 2005


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 127.0.0.1] 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 127.0.0.1] | 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';

__PACKAGE__->config(
...
);

1;

All modules in lib/DieselCatalyst/M/CDBI/ should inherit automagically
from that class, but just to make sure you can do:

use base 'DieselCatalyst::M::CDBI'; in the classes and see what happens
then.


> Do I need to do something akin to Maypole's setup()-then-require trick?
> (Presumably in a much more elegant manner though :)

You won't find something like that in Catalyst-land. ;)

> Cheers,
> Toby

If the above stuff does not help/work, please paste your CDBI.pm in your
reply.

Regards,
Danijel




More information about the Catalyst mailing list