As mentioned above, the access restrictions in Perl are more about manners than the loaded shotgun of Java or C++. However, in looking at your post it drew a few parallels (for me at least) with the way classes operate in Java. In otherwords, only one public class per file.

Personally I don't think theres anything wrong in having more than one class per file provided one class (and one only) is considered public, as in Java. The others are then private (manners permitting) and only exist to support the public class. And thats the important point. If My::B were to support anything other than My::A then it would have its own file.

I can think of a few examples of where this is done, HTML::Template being one of them (if memory serves me correctly at least).

In reply to Re: Private Classes - Same or Separate Files? by simon.proctor
in thread Private Classes - Same or Separate Files? by Masem

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.