[Dbix-class] problem using model->search: only one item is retrieved

Jesper Krogh jesper at krogh.cc
Thu Jun 15 16:14:24 CEST 2006


> and in my genes template:
>
> [% FOREACH obj IN geners.next() %]
> [% obj.gene_id %]
> [% obj.gene_name %]
> [% obj.gene_length %]
> et cetera [% END %]

If you were writing perl, this would translate into:

foreach my $obj($geners->next()){

}

Which definately also would be only one record, since $geners->next only
gets evaluated first.. expecting to expand to a liste that the foreach
loop would iterator over. It doesn't it returns only the first element.

Correct whould be:

while(my $obj = $geners->next()){

}

It is left to you to translate it back to TT.. (I use HTML::Mason) which is
perl.

Jesper
-- 
Jesper Krogh




More information about the Dbix-class mailing list