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

Mike Friedman friedo at friedo.com
Tue Oct 31 04:34:02 GMT 2006


On 10/30/06, A. Pagaltzis <pagaltzis at gmx.de> wrote:
> This ain't Java.
>
>     my @table_class = qw( MyTable MyTable2 );
>
>     for my $t ( @table_class ) {
>         *$t = sub { $_[0]->resultset( $t ) };
>     }
>

You have to turn strict references off to do that, of course. (You
_DO_ have strict on, right? :) )

This is basically what I ended up doing in my schema class, by looping
over __PACKAGE__->sources.

I also exported the methods, as per Dan's suggestion, so I can use
them as mixins in my webapp object.

Thanks for all the help and discussion, everyone. I think I've got a
handle on things now.



Mike



More information about the DBIx-Class mailing list