[Petal] Does Petal support a simple while loop?

Grant McLean grant at mclean.net.nz
Sun Jun 22 12:13:21 BST 2003


I know that petal:repeat can be used to iterate through an arrayref
of hashrefs like this:

   <ul>
     <li petal:repeat="row hashlist">
       <span petal:replace="row/product_id">Product ID</span>:
       <span petal:replace="row/description">Description</span>
     </li>
   </ul>

What I'd like to do is use a resultset object with a ->next() method
like this:

   <ul>
     <li petal:repeat="row rs/next">
       <span petal:replace="row/product_id">Product ID</span>:
       <span petal:replace="row/description">Description</span>
     </li>
   </ul>

ie: the expression (method call) is evaluated repeatedly until it
returns undef.

Is there some way to do this already?  If not, should I whip up a
patch?

Regard
Grant





More information about the Petal mailing list