[Dbix-class] Re: Get table name from ResultSet class?

Peter Rabbitson rabbit+dbic at rabbit.us
Fri Sep 23 08:40:17 GMT 2011


On Thu, Sep 22, 2011 at 02:04:04PM -0700, Lyle Kopnicky wrote:
> I just found an easier solution. Instead of:
> 
> __PACKAGE__->table_class('My::Schema::ResultSource::MyTable');
> 
> I override the table_class accessor:
> 
> sub table_class { 'My::Schema::ResultSource::MyTable' }
> 
> That way when sub table is called, the table_class is already defined.

Except that now table_class() is no longer an accessor, it's a plain constant.
Think of the cursing your way when the next maintainer needs to subclass your
own subclass and spends hours trying to figure out why all the examples he
can find do not seem to work for him.

Cheers



More information about the DBIx-Class mailing list