Slash Boxes
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

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
More | Login | Reply
Loading... please wait.
  • I don’t understand having ->first and ->last be 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.