Jun 29, 2000, 10:41 PM
Post #2 of 4
My big project started with one script that was called for everything. It then determined what to do, 'required' the appropriate files to get some subroutines, and did stuff.
Re: Which is better, one big script or multiple small scripts?
[In reply to]
The problem I ran into was that the special cases started to get out of hand after about a year and it was a pain to continue to evolve the project.
The new model is to have dozens of very small scripts that 'use' the correct combination of modules and verify that it was sent the right data, then make a call to one of the modules.
One other change I made was to split the doing of stuff from the display of stuff.
For example if you want to delete something from a page, you call edit.pl which will make the changes. But edit.pl has no knowledge of how to display the page. After it has done its business it prints "Location:display.pl\n\n" and ends.
Then display.pl takes over and prints the page to the browser. A nice side effect of this is that if the user tries to reload the page, then they are reloading the display, not the edit, so there is less chance of corrupting the data and it does what they expect it to.