Hello hotshoe, and welcome to the Monastery!
You have received some good answers above. I just want to add a couple of points:
(1) Your statement:
The client shouldn't be interfacing directly with these submodules.
is ambiguous. Do you mean that the client must not access these modules directly; or only that the client doesn’t need to do so to use the Foo module? As a general rule, you should aim for the latter. Good design entails loose coupling between modules. Even if a given module is not likely to be reused, design it as though it could be reused and your architecture will be cleaner and easier to maintain.
(2) In those rare cases where access to a module such as Foo::Util really must be restricted to Foo, you can take stevieb’s ingenious approach. But bear in mind this famous quote from Larry Wall:
Perl doesn’t have an infatuation with enforced privacy. It would prefer that you stayed out of its living room because you weren’t invited, not because it has a shotgun.
Perl has a simple convention to indicate “not invited” — an initial underscore. So, if you rename Foo::Util to Foo::_Util, any experienced Perl programmer will immediately know that this module is for internal use only. An example is provided by the Moo::_Utils module in the Moo distribution on CPAN.
Hope that helps,
| Athanasius <°(((>< contra mundum | Iustus alius egestas vitae, eros Piratica, |
In reply to Re: documentation best practices for internal modules
by Athanasius
in thread documentation best practices for internal modules
by hotshoe
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |