in reply to Re^2: Methods in template toolkit
in thread Methods in template toolkit

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.