[Dbix-class] Re: want to confirm on issue in cookbook

Joel Bernstein joel at fysh.org
Mon Nov 10 03:24:50 GMT 2008


2008/11/10 Mike. G <hylinux at gmail.com>:
> about this statement:
>
> $new_source->name( \<<SQL );
>
>
> why I can't find out the method name "name" in class ResultSource?

Because it's not a method defined with "sub name { ... }" but a simple
data accessor created with:
__PACKAGE__->mk_group_accessors('simple' => qw/_ordered_columns
  _columns _primaries _unique_constraints name resultset_attributes
  schema from _relationships column_info_from_storage source_info
  source_name/);

Note "name" as the fourth entry on the second line. That creates an
accessor/mutator
method (a combined get and set method) called "name".
mk_group_accessors is inherited
from DBIx::Class, which in turn inherits it from
Class::Accessor::Grouped, which is the property
accessor generator used in the current CPAN release of DBIC.

Hope this helps,

/joel



More information about the DBIx-Class mailing list