[Dbix-class] more schema questions

Matt S Trout dbix-class at trout.me.uk
Sat Jan 7 22:08:50 CET 2006


On Fri, Jan 06, 2006 at 03:27:56PM -0800, Alan Humphrey wrote:
> Doh!  Never mind.  Forgot the 'use' statement.
> 
> Incidentally, Matt, could you expound a bit on this piece of advice.  Both
> seem to work and the docs show the former approach.  Thank you!
> 
> > my $obj = BirdWeb::Admin::Model::DBIC::Birds->find(234);
> 
> better
> 
> my $obj = BirdWeb::Admin::Model::DBIC->class('Birds')->find(234);

The Schema.pm docs probably need updating then. The latter form is preferred
because it means you don't end up hard-coding everything - if you're in
Catalyst then

my $obj = $c->model('DBIC')->class('Birds')->find(234);

is probably even better :)

-- 
     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