I normally tend to write Perl modules only when I think they would be useful across different Perl scripts.
But here's a question:
When we write Perl modules, do we only write them when a pm would be used across different scripts implementing different tasks?
OR
Can we write Perl modules to group all the sub-functions within one script and put them in the module, so that what we get in the end is a C-programming style separation of sub routines? E.g., in C, you could call the program with the 'main' function as the 'Client' program and create another program that implements the sub-functions that the client can invoke. In this way, the client program simply invoke the services of the program implementing sub-routines. This also ensures that any change to the internal implementation of the sub-routine would require no change to the client program.
Can we do the same in Perl using a perl module?
Any thoughts would be much appreciated.
Thank you!