For whatever it may be worth ... when any project that I am working with starts to grow to encompass “multiple .PM files,” I try to start thinking in terms of “Perl objects.”
If I construct my “Perl module” in terms of “it creates and defines a Perl object,” I know that I will get a whole lot of advantages, all at once ...
-
I have “a very easy means to get my hands on a very convenient handle” (namely, the object instance...) which gives me simultaneous access both to operative code and an associated, per-instance, block of data. Every sub that I define now becomes “a method of an object,” which will automagically be given a reference to that object-instance as its first parameter. This gives tremendous flexibility with regard to how you manage storage, and it also greatly reduces the coupling, or unwanted interference, between the various modules.
-
I virtually eliminate the need to mess with “globals,” which of course are probably (IMHO) the single biggest source of “coupling.” In this scenario, every object has its own private play-pen. From a purely pragmatic, bug-reducing perspective, that is huge.
-
I can coin just as many instances of a particular object as I want, and every one of them will be distinct.