in reply to Indent, anonymous sub, or lexical sub for module private code?
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
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^2: Code reuse question (indent another level or non global subroutine or anonymous or sub _private_by_convention)
by 1s44c (Scribe) on Jul 31, 2014 at 14:24 UTC |