Is an anonymous sub the right thing here?

A named subroutine will work (its what you want), just give it a prefix of "_", make it sub _private_by_convention { ... }

This signals to all who load your module not to rely on sub _private_by_convention because its not part of the public api

I thought this was mentioned in See perlstyle, perlstyle but its not, it is however mentioned in Perl::Critic::Policy::Subroutines::ProtectPrivateSubs and Perl::Critic::Policy::Subroutines::ProhibitUnusedPrivateSubroutines

Yes, too much indentation isn't exactly skimmable code :)

Also, "Code reuse question" has got two stopwords ("code" and "question"), all nodes of type perlquestion are questions about code :) see How do I compose an effective node title?

I don't have a much better


In reply to Re: Code reuse question (indent another level or non global subroutine or anonymous or sub _private_by_convention) by Anonymous Monk
in thread Indent, anonymous sub, or lexical sub for module private code? by 1s44c

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.