I have actually changed the implementation of this - the call was going through a loop, filling table data cells - many database calls. I now have this:
sub get_variant_measurements { my $resultset = shift; my $variant_id = @_; my $variant_measurements = $resultset->search_related( 'variant_measurements', { }, { 'order_by' => ['variant_id','measurement_id'] }, ); return $variant_measurements; }
This is passed to the template, which then does this:
[% WHILE ( type_measurement = type_measurements.next ) %] <tr> [% WHILE (variant_measurement = variant_measurements.next) %] [% IF variant_measurement.measurement_id == type_measurement.measure +ment_id %] <td> <input type="text" size="3" name="measure-[% variant_measurement.variant_id %]-[% typ +e_measurement.measurement.measurement %]" value="[% variant_measurement.value %]" /> </td> [% END %] [% END %] </tr> [% END %]
Little hard to work out from the current context, what the db calls done previously in a loop in the template are now carried out in one database call in the handler.

In reply to Re^3: Methods in template toolkit by dariusj
in thread Methods in template toolkit by dariusj

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.