[Dbix-class] more schema questions

Matt S Trout dbix-class at trout.me.uk
Wed Jan 18 15:27:51 CET 2006


On Tue, Jan 17, 2006 at 11:31:08PM -0600, Brandon Black wrote:
> On 1/7/06, Matt S Trout <dbix-class at trout.me.uk> wrote:
> > On Sat, Jan 07, 2006 at 09:24:57PM +0000, Chisel Wright wrote:
> > > On Sat, Jan 07, 2006 at 09:18:10PM +0000, Matt S Trout wrote:
> > > > If you're hoping your Cat + DBIC app will eventually run multiple times
> > > > under mod_perl with different configs, this is the way to do it :)
> > >
> > > I hadn't thought that far ahead, I was just thinking that the way I'm
> > > doing it now isn't as portable.
> > >
> > > I've been doing:
> > >
> > > MyApp.pm:
> > >
> > > our $foo_class = 'MyApp::Model::MyDB::Foo'
> > > # etc
> > >
> > > and using
> > >
> > > $MyApp::foo_class->search( ... );
> > >
> > >
> > > Is the method you mentioned something new in the 5.x series? I don't
> > > recall a $c->model() method, and it's sometimes hard to keep up with all
> > > the changes. [This is where I look really stupid and find it's been
> > > there for months...]
> >
> > ->model, ->view and ->controller were added in 5.50
> >
> > ->model('DBIC') is *mostly* equivalent to
> >
> > $c->comp('Model::DBIC') || $c->comp('M::DBIC');
> >
> > but I'll skip the details, since we appear to be on the wrong list :)
> >
> 
> Back on the right list, is there any "correctness" differential between using
> 
> $db_class->class('Foo')->...
> 
> and
> 
> $db_class->table('foo')->...
> 
> or is it just a matter of whichever namespace is easier for you to
> remember the names in?

->class is schema syntax

->table is a Loader-ism. I'd love to see Loader just return a schema
object so everything becomes uniform (Schema is The Way Forwards :)

-- 
     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 Dbix-class mailing list