NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.
All the Perl that's Practical to Extract and Report
Stories, comments, journals, and other submissions on use Perl; are Copyright 1998-2006, their respective owners.
Re: (Score:1)
I don’t understand having
->firstand->lastbe methods of the main class.I think you are trying to keep the innards of the iterator separate from the iterator class, right? That would be a worthwhile goal, but as it stands, your design means you can only ever have one iterator at a time per Array::AsHash instance. Someone’s going to get bitten by that at some point.
You could achieve separation on both levels by making two (or three) closures that close over the same variables, of which one is the iterator and the others are first/last state checkers.
Reply to This