The idea is that if the iterator already has a value, I don't want to change that value automatically blindly. I'm allowing the iterator to be pre-set prior to the first call to FIRSTKEY. The only time I want to set the iterator to zero, is if it has already reached the last key (I do this check elsewhere), or if it has not yet been set at all. Try it out, it works. :)

By the way, I should mention that this class is pretty much unneeded. Anytime the functionality of this type of class could be needed, it could be accomplished more easily by creating an external keys list with keys, and iterating over that list. I really just wanted to see if I could figure out how to make it work internally via each. It works, but it's ugly and unwieldy.


Dave


In reply to Re^2: Localizable / customizable 'each' iterator for hashes by davido
in thread Localizable / customizable 'each' iterator for hashes by davido

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.