Iterator class in 'quite slow' shoclker

TeeJay on 2003-04-12T18:14:34

I have been playing around with a nice iterator object (for use in TT templates) and it seems impossible to make more than half the speed of copying an array of arrays into an array hashrefs.

This is using perl 5.6.1 so Object calls in Perl 5.8 may be faster but not much.

Anyway the iterator is very easy to use, and means I can change underlying data structures and the iterator just works.

This means my current web project (a resteraunt and entertainment search engine) uses two patterns - SQL Phrasebook and Iterators. I wonder how many more I can get in.


Template::Iterator

dlc on 2003-04-14T13:55:50

I have been playing around with a nice iterator object (for use in TT templates)

If you are only using these iterator objects within TT, take a look at Template::Iterator -- every FOREACH and FOR loop within a template is already implemented using an Iterator (that's the loop special variable). This iterator class is trivially modifiable to work outside of TT, as well, if you want to go that way.