in reply to Private Classes - Same or Separate Files?

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).
  • Comment on Re: Private Classes - Same or Separate Files?

Replies are listed 'Best First'.
Re: Re: Private Classes - Same or Separate Files?
by ignatz (Vicar) on Mar 06, 2002 at 15:42 UTC
    I like it best when the visible file names match the public functionality of the Classes. Too many inner working files just ends up being a headache and doesn't tell people using your classes anything useful.
    ()-()                                                      ()-()
     \"/    DON'T   BLAME   ME,   I  VOTED   FOR    PACO!       \"/
      `                                                          `