in reply to Localizable / customizable 'each' iterator for hashes
Tied hash iterators have a strange division of responsibility: perl's actual iterator on the tied HV is responsible for tracking whether FIRSTKEY or NEXTKEY should be called, and the tied class is responsible for determining which key should be returned next. This allows things like void context keys() or values() to reset the iterator without actually calling any tie functions. So FIRSTKEY should always start at the beginning.sub FIRSTKEY { ... $iterator = 0 unless defined $iterator;
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Localizable / customizable 'each' iterator for hashes
by davido (Cardinal) on Jul 20, 2004 at 00:38 UTC | |
by ysth (Canon) on Jul 20, 2004 at 01:07 UTC |