[Catalyst] Migration from Class::DBI to DBIx::Class (with CDBICompat)

Matt S Trout dbix-class at trout.me.uk
Sun Jan 8 22:00:39 CET 2006


On Sun, Jan 08, 2006 at 07:18:43PM +0100, Michele Beltrame wrote:
> Hi all!
> 
> I'm in the process of migrating my Catalyst application from Class::DBI 
> to DBIx::Class. Before exploring the latter module well, I would like to 
> get everything up and running with the CDBICompat layer. However, I'm 
> unsure on how to achieve this within a Catalyst application.
> 
> I trying changing my DB model class to contain this:
> 
> -----
> package Aintra::M::DB;
> 
> use strict;
> use base 'Catalyst::Model::DBIC';
> 
> __PACKAGE__->load_components(qw/CDBICompat Core DB/);
> 
> __PACKAGE__->config(
> [...]
> -----
> 
> However, I get a "Can't locate object method "load_own_components" via 
> package "Aintra::M::DB".
> 
> How do I enable the Class::DBI compatibility layer?

That isn't going to cut it; CDBICompat needs Class::DBI style column
definitions as well - you could try creating a base class that loads
CDBICompat and Core and then passing that as left_base_classes to the
Loader in Catalyst::Model::CDBI.

If all you actually want is to emulate the Class::DBI *interface*, then you
could see about starting with a Catalyst::Model::DBIC and adding specific
parts of CDBICompat to left_base_classes until you get a recipe that works.

-- 
     Matt S Trout       Offering custom development, consultancy and support
  Technical Director    contracts for Catalyst, DBIx::Class and BAST. Contact
Shadowcat Systems Ltd.  mst (at) shadowcatsystems.co.uk for more information

 + Help us build a better perl ORM: http://dbix-class.shadowcatsystems.co.uk/ +



More information about the Catalyst mailing list