This module does everything you'd expect from a class implementing an iterator, apart from one thing: it buffers one element of the stream of scalars, produced by your code. The buffering is done by pre-fetching one element as soon as your iterator has been initialized. Every subsequent fetch will return the buffered element and add a fresh element to the internal buffer.
This behavior leads to unexpected results, and if you are using non-pure functions for you iterators (such as database operations or accessing shared variables), your code may deadlock or behave as if everything happens out of order.
If you do use pure functions for your iterators, you may find that this module is exactly what you need.
3 out of 3 found this review helpful. Was this review helpful to you? Yes No
This is an excellent reference implementation of the Iterators in Dominus's _Higher Order Perl_. Easy to use, and I definitely recommend it if you're doing anything with iterators.
The documentation includes a very good tutorial if this is your first introduction to Iterators.
Be sure to look at the various Iterator::* classes as well
7 out of 9 found this review helpful. Was this review helpful to you? Yes No