Since you're being so nice! Here is something else you might try. Part of the power of DBIC is the chained ResultSet. Customizing them with semantically significant names (beware shortcut names) can let you build up an amazing set of chained stuff. For example–

package LIBL::Schema::ResultSet::PlayerDataCurr; use strict; use warnings; use parent "DBIx::Class::ResultSet::HashRef"; # <-Nice alternative to +DBIx::Class::ResultSet. sub teams { +shift->search({ team_libl => { '!=' => undef } }); } sub teams_rs { scalar +shift->teams } sub with_id_static { +shift->search({}, { prefetch => [ 'id_static' ] }); } sub with_id_static_rs { scalar +shift->with_id_static } 1; __END__ =pod =head1 Do you even Pod? L<JSON> + L<DBIx::Class::ResultSet::HashRef> for speedy delivery. use JSON; for my $team ( $player_curr_model->teams->hashref_rs->all ) { print encode_json($team), $/; } # OR my @teams = $player_curr_model ->teams ->with_id_static; =cut

So, that is pretty contrived (and again UNTESTED) with splitting the with_id_static out but I think you can see how to put it back into the other sub and mix and match and build up chained calls that keep it very semantic and easy to test, repurpose, and maintain. DBIx::Class::ResultSet::HashRef is a regular ResultSet class with shortcuts to avoid the penalty of inflating data to objects when you prefer.


In reply to Re^3: Trouble Getting Field Through A DBIx::Class::ResultSet Relation by Your Mother
in thread Trouble Getting Field Through A DBIx::Class::ResultSet Relation by varanasi

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.