[Catalyst] CDBI integration

Marcello Romani mromani at ottotecnica.com
Tue Jun 13 13:38:56 CEST 2006


Pablo Collins ha scritto:
> HI all,
> 
> I have a bunch of Class::DBI packages in a directory/namespace outside 
> of the catalyst app I'm building and I would like to make them available 
> as the model layer.
> 
> It looks like if you want a model layer in catalyst, each class has to 
> be inside the top-level namespace of the application. I would prefer to 
> not have to create a package for each catalyst model class that says 
> "package MyApp::Model::Foo; use base 'MyModel::Foo';" for each package. 
> It would be neat if you tell the config where your model files live and 
> have catalyst slurp them up.
> 
> Another thing: from looking at Catalyst::Model::CDBI::Plain it looks 
> like your model classes are supposed to inherit from Catalyst::Base and 
> also provide a constructor called 'new', but I was able to integrate my 
> outside CDBI classes into catalyst without inheriting from 
> Catalyst::Base. Do model classes have to inherit from Catalyst::Base? 
> Base.pm <http://Base.pm> doesn't seems to provide any functionality that 
> seems appropriate for a model.
> 
> One issue I am having however, is that when using the 
> Catalyst::Engine::HTTP, it doesn't cache database connections, so 
> development is rather slow. How do I set catalyst with 
> Catalyst::Engine::HTTP up to cache connections?
> 
> Cheers,
> 
> -Pablo
> 
> 
> 
> ------------------------------------------------------------------------
> 
> _______________________________________________
> Catalyst mailing list
> Catalyst at lists.rawmode.org
> http://lists.rawmode.org/mailman/listinfo/catalyst

I've just started using DBIC in catalyst, and the intro docs show you ho 
to do just what you need right from the start.

IMHO this is a good reason (among others that anybody here will be glad 
to show you :-) to change from cdbi models to dbic ones.

Unfortunately, migrating an app (even a simple one) from cdbi to dbic 
(natively, i.e. without using dbic's compatibility layer) is not so 
easy... (well, at least not for the ancillary features I've added to my 
cdbi model classes :-)

-- 
Marcello Romani
Responsabile IT
Ottotecnica s.r.l.
http://www.ottotecnica.com



More information about the Catalyst mailing list