[Catalyst] Models and inflating

Alexander Tamm alex at frantic.com
Mon Feb 23 17:16:19 GMT 2009


Hi,

I'm still a bit confused about how models using DBIx::Class should work 
in a catalyst application.

Is it the case that classes placed in the Model-directory will somehow 
(magically?) let me have objects inflated as instances of the class 
using a similarly named Schema?

For example, I have this class:

package TestApp::Model::Foo::User;

use strict;
sub full_name {
     my ( $self ) = @_;
     return $self->first_name() . q{ } . $self->last_name();
}
1;

Objects created by $c->model('Foo::User') *will* work. Ie. they have the 
methods full_name(), first_name() and last_name().

It looks a bit weird to me, but it seems to work. Should it work?

I also have another application A which has a more complex setup. 
Application A also works. OTOH, application B, which is very similar to 
application A, does *not* work. I get an error message saying "Can't 
locate object method "inflate_result" via package B::Model::DB::Snafu.

Can't really paste the code here, but I'd like some pointers where to 
look for the cause of the error. Should it work at all, or do TestApp 
and A work through some weird lucky bug?

Cheers,
Alex




More information about the Catalyst mailing list