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

Fernan Aguero fernan at iib.unsam.edu.ar
Thu Jun 15 19:08:21 CEST 2006


+----[ Jesper Krogh <jesper at krogh.cc> (15.Jun.2006 11:19):
|
| > 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()){
| }

Of course. Glaringly obvious ... argh!

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

[% WHILE (obj = geners.next()) %]
[% END %]

Thanks,

Fernan



More information about the Dbix-class mailing list