[Petal] Does Petal support a simple while loop?
Fergal Daly
fergal at esatclear.ie
Tue Jun 24 13:04:10 BST 2003
On Tuesday 24 June 2003 11:27, Grant McLean wrote:
> Yes, those are approaches to the specific issue of iterating through
> a list of values, but my specific requirement was really crying out
> for nested while loops. To restate it in Perl:
>
> while(my($artist) = $rs->grouped_column('artist')) {
> print_heading($artist);
> while(my($row) = $rs->next) {
> print_item($row);
> }
> }
>
> So the call to $rs->grouped_column('artist') causes subsequent
> calls to $rs->next to terminate when the value in the 'artist'
> column changes.
Assuming you can specifiy arguments to the get_next method, what would be
wrong with something like
<t petal:cursor="artist gouped_column('artist') rs">
heading
<t petal:cursor="row next rs">
row
</t>
</t>
> Generic iterator support is not actually going to solve that
> problem whereas a petal:while construct would.
I think it does assuming get_next can have arguments,
F
More information about the Petal
mailing list