Well off the top of my head...
1. There is no need to do this! That's a big reason.

2. This is an overly complex calling syntax that is non-standard versus Perl norms. In general coding confusion into the program is not a good idea. That is an opinion. But I think that tricky non-standard things should be avoided.

3. This would interfere with some Perl debugging features.
 $subname = sub{...blah..} is ref to an anyon sub. Consider:

sub whoami { (caller(1))[3] }; #returns name of the sub that called +this sub sub whowasi { (caller(2))[3] }; #returns name of the parent of the su +b that called this sub
In the case of $subname, there is no "name". I sometimes use code like whowasi() for debugging to trace back to where some weirdo sub input came from. If you are proposing to put a large number of anon subs in a module, this kind of idea breaks.

Just because something is possible, doesn't mean that you should do it.

For me: no need, overly complex, non-standard is enough. As I mentioned above there are ways to regulate what sub names get "exported" from a module which is a subset of the names in the package symbol table. There are naming conventions for OO methods like (_xyx is private). All that is "good enough".


In reply to Re^5: private sub routine by Marshall
in thread private sub routine by saranperl

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.