[Dbix-class] Use of ->resultset mandatory?

Steven Mackenzie dbix at aptile.co.uk
Mon Oct 30 22:39:59 GMT 2006


Christopher H. Laco wrote:
> Steven Mackenzie wrote:
>   
>> Christopher H. Laco wrote:
>>     
> There's no reason you can't put this in your schema class:
>
> sub MyBest {
>    return shift->resulset('MyBest');
> };
>   
Thanks for the tip (and Dan and Mike) -- I think I will do that in future.
> As for the above examples, they're not the best. The main point is, the
> name used in resultset() could be the class name or the source_name. Any
> number of classes can use the same table, so just adding shortcuts for
> the table name is futile. People can set the source_name to abstract
> away from the class names, so when the class names change, the
> resultset() calls don't have too....and various other reasons...
>   
Yes, you've convinced me that the shortcut methods shouldn't be to the
class or table name.

But the accessors to source_name could be provided in the schema object
by default without limiting the ability to decouple source_name from the
table name. If source_name is not set, then it is implied currently
anyway (defaulting to the table name?)

Thanks for the clarity, and thanks to Mike for the question!

Steven





More information about the DBIx-Class mailing list