in reply to
Re: Program structure: subs vs modules vs Selfloader
in thread Program structure: subs vs modules vs Selfloader
If the subroutine is only useful in this script, I leave it in.
For any sizeable project, I have a tendency to go the other way and put virtually all of the functionality of the program into Modules.
The front end program(s) just parse command line options and call the right modules. They also hold the POD documentation for the end user. The Modules have the POD documentation for their API.
Then it is really easy to have separate front end test scripts that set up certain conditions and call the modules the same way the real front end program does.
I figure even if the module never gets re-used, it is still nice to have a clean well-documented API to it that can be easily exercised by test scripts.