[Catalyst] Some guidance needed please

Simon Wilcox simonw at digitalcraftsmen.net
Thu Sep 13 17:50:21 GMT 2007


Matt S Trout wrote:
> On Thu, Sep 13, 2007 at 03:14:58PM +0100, Ian Docherty wrote:
>> Almost, if I do my $used_password = 
>> $c->model('DBIC::UsedPassword')->result_class->create_limited();
>>
>> it works. So that should do for now, thanks Simon and Will for your help ;)
> 
> No. Don't do that.
> 
> Really don't.
> 
> It's utterly broken.

Thanks. I'm not as familiar with the interaction of DBIx::Class and 
Catalyst::Model::* as you are (obviously, I didn't write 'em :) but from 
here:

http://search.cpan.org/~ash/DBIx-Class-0.08007/lib/DBIx/Class/ResultSet.pm#result_class

I find:

result_class

     Arguments: $result_class?
     Return Value: $result_class

     An accessor for the class to use when creating row objects. 
Defaults
     to result_source->result_class - which in most cases is the name of
     the "table" class.

This seems to be the right behaviour to me. Can you summarise why it is 
not ?

Yet over here:

http://search.cpan.org/~blblack/Catalyst-Model-DBIC-Schema-0.20/lib/Catalyst/Model/DBIC/Schema.pm

I find:

class

     Shortcut for ->schema->class


So would the original be better written as:

$c->model('DBIC::UsedPassword')->class->create_limited(); # ?

If it's not this then the docs are really confusing and I'd really 
appreciate it if you could provide the correct usage or approach for 
this situation.

Many thanks,

Simon.



More information about the Catalyst mailing list