[Catalyst] iterating twice over the same resultset in the template?

Jonathan Rockway jon at jrock.us
Wed Jan 3 19:49:39 GMT 2007


> [% WHILE ( it = rs1.next() ) -%] ...
> [% WHILE ( it = rs2.next() ) -%] ...
>
> Is there any other way to do this? Is it possible to clone a
> resultset?


Why not just prefetch everything?

Controller:

my @elements : Stashed = $c->model("MyDB::table")->...->all;

Template:

[% FOREACH element = elements %]
...
[% END %]



-- 
package JAPH;use Catalyst qw/-Debug/;($;=JAPH)->config(name => do {
$,.=reverse qw[Jonathan tsu rehton lre rekca Rockway][$_].[split //,
";$;"]->[$_].q; ;for 1..4;$,=~s;^.;;;$,});$;->setup;



More information about the Catalyst mailing list