[Dbix-class] RFC: sub foo :ResultSet(bar) {...}

phaylon phaylon at dunkelheit.at
Sun Apr 16 23:44:47 CEST 2006


Hello everyone,

I worked out a patch that allows it to pass the method name to the
ResultSet attribute. I had/have a need for this because I want(ed) to
define two methods (on for the result set, one for the row) with the
same name in my table class.

Example:

  __PACKAGE__->load_components(qw/ ResultSetManager Core /);

  sub as_xml {...}
  sub _rs_as_xml : ResultSet(as_xml) {}
  ...

  my $rs      = $schema->resultset( 'Class' );
  my $rs_xml  = $rs->as_xml;
  my $row     = $rs->first;
  my $row_xml = $row->as_xml;

Possible patch against -current is attached, comments would be welcome!


p
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dbic_cur_resultset_named.patch
Type: text/x-patch
Size: 3165 bytes
Desc: not available
Url : http://lists.rawmode.org/pipermail/dbix-class/attachments/20060416/2265fdf1/attachment.bin 


More information about the Dbix-class mailing list