[Dbix-class] Thoughs about DBIx::Class::ResultSet::WithMeta

Pedro Melo melo at simplicidade.org
Mon Jan 11 15:34:56 GMT 2010


Hi,

I have the problem that DBIx::Class::ResultSet::WithMeta solves, but
in my case the fact that it is always iterating over the results kills
performance quite a bit. I was wondering about using a object in the
call to result_class(). Sure, the docs tells us that it should be a
class, but as long as your object does respond properly to new() and
inflate_result() it should be possible to do something like this:

  my $meta = MyWithMeta->new;
  $meta->add(sub { ... your code per row goes here ... });
  ## optionally allow for multiple
  $meta->add(sub { ... other code per row ... });

  $rs->result_class($meta);

Then you get your $meta->inflate_result called per row, only at the
last point in the search() chain.

Thoughts?

Bye
-- 
Pedro Melo
http://www.simplicidade.org/
xmpp:melo at simplicidade.org
mailto:melo at simplicidade.org



More information about the DBIx-Class mailing list