Beefy Boxes and Bandwidth Generously Provided by pair Networks
good chemistry is complicated,
and a little bit messy -LW
 
PerlMonks  

Re^2: Program structure: subs vs modules vs Selfloader

by ctilmes (Priest)
on Jun 21, 2004 at 11:56 UTC ( #368415=note: print w/ replies, xml ) Need Help??


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
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

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://368415]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (16)
As of 2014-07-10 19:38 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    When choosing user names for websites, I prefer to use:








    Results (215 votes), past polls