Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Comment on

( #3333=superdoc: print w/replies, xml ) Need Help??

I personally believe and hope that this node can be considered as an "ever active one" so I won't clutter Meditations with this "new" idea of mine like I've been tempted to do, but post it as a followup here...

Well, here's my modest proposal re join: if the first argument passed to it is a reference, then it should not stringify it (which is unlikely to ever having been useful, and thus should not break any backwards compatibility) but

  1. if it is a hashref of the form { first => [LIST], then => [LIST] } then it should join the first items on the 'first' list and the remaining ones on the 'then' one, cyclically; for maximum dwimmery, if keys other then these (or better chosen ones, but these sound reasonable) are given, the first two in alphabetic order (which does make sense) would be used; if any key is missing, then the corresponding LIST would be treated as empty;
  2. if it is an arrayref $arr, then it would behave as if it were {then => $arr};
  3. if it is a subref then the subref would be called each time, with no arguments and its return value would be used to join on;
  4. if it is a scalar or glob ref, then I can't imagine any particularly good semantics; and if it is a blessed ref, then... I was thinking of making it check for especially named methods like 'action' (corresponding to the sub case above, and possibly taking precedence,) 'first' and 'then' but probably it would be better to just leave the object stringify the way it prefers and not deviate from the current behaviour.
If you can't understand the incipit, then please check the IPB Campaign.

In reply to Re: what would you like to see in perl5.12? by blazar
in thread what would you like to see in perl5.12? by ysth

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
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others about the Monastery: (5)
    As of 2018-05-27 06:12 GMT
    Find Nodes?
      Voting Booth?