Beefy Boxes and Bandwidth Generously Provided by pair Networks
Your skill will accomplish
what the force of many cannot

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
Thank you, Eily. I just made the change to my actual code, and VOILA! It works.

It makes perfect sense, too. My problem lay in not understanding the need to return the return — I guess having so many returns is counterintuitive to me.

UPDATE: In the groggy wee morning hours, I understated the number of returns involved... the fix is actually returning the returned return. Yup, that's three returns, folks. No wonder I couldn't get my brain around it before reading Eily's elucidating answer.

Even though I thanked Mark Jason Dominus in my OP, it was actually Chap. 2 of his book that originally led me astray, since it shows coderefs everywhere an anonymous subroutine is too large to include right in a dispatch table:
$dispatch_table = { CHDIR => \&change_dir, LOGFILE => \&open_log_file, VERBOSITY => \&set_verbosity, ... => ..., };
(Higher-Order Perl, p. 44)

Of course, Chap. 2 didn't contemplate returning iterators, which don't really make an appearance until Chap. 4, so this is not a condemnation of MJD or his excellent book — without which I wouldn't even be using iterators in the first place. No, the fault is completely mine for mixing concepts MJD didn't intend to combine at that point in the book. Mea culpa.

In reply to Re^2: Choosing between multiple closures by oakb
in thread Choosing between multiple closures by oakb

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, 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, 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.
  • Log In?

    What's my password?
    Create A New User
    [erix]: do you mean: 'it can be done simpler', or 'it won't work' ?
    [choroba]: I wouldn't want to maintain it in the current form
    [erix]: ok, but mainainability comes after it has been made to work :)
    [erix]: maybe I should have cobbled together a more simple example
    [erix]: the main question is whether repeating groups get captured. I thought they did but it looks they do not.

    How do I use this? | Other CB clients
    Other Users?
    Others having an uproarious good time at the Monastery: (6)
    As of 2018-01-19 08:36 GMT
    Find Nodes?
      Voting Booth?
      How did you see in the new year?

      Results (216 votes). Check out past polls.