http://www.perlmonks.org?node_id=368415


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.

  • Comment on Re^2: Program structure: subs vs modules vs Selfloader

Replies are listed 'Best First'.
Re^3: Program structure: subs vs modules vs Selfloader
by CountZero (Bishop) on Jun 21, 2004 at 16:11 UTC
    Well, that is the power of Perl: TIMTOWTDI!

    CountZero

    "If you have four groups working on a compiler, you'll get a 4-pass compiler." - Conway's Law