in reply to CGI: Make one big program or lots of little ones?

One script or many: When the user is posting changes, I have found it helpful to have two scripts. Let's call them show.pl and post.pl. The various forms specify post.pl in the action for the <form...>. Then after processing the post, the post.pl script spits out an HTTP location header line that takes the client browser back to the show.pl script displaying whatever is appropriate.

This is nice for separating functionality. But more importantly, because the page the browser sees is not a direct response to a form, the dreaded "Repost form data?" pop-up message does not appear if the user happens to hit Reload.

Output, wait 30 seconds, output another page: Normally you cannot do that (check on push techniques if you want to explore doing it). Think about it, the server only serves when a browser requests a page. The browser only is ready to receive a page right after it has send the server a request. Even if you had the server spit out another page, the browser would not be waiting for a page and would just ignore it.

If you meant, can a script respond to one browser request and then the same script respond to a different browser request 30 seconds later, the answer is Yes. Which brings us to:

Some mechanism to decide which subroutine... Three ways come quickly to mind.

   1)Query string values
   2)Extended url path values
   3)<input type=hidden...>

If you need more info about any of these, just repost and I or someone else is sure to respond.

And of course you are using CGI.pm...

Good luck.

  • Comment on Re: CGI: Make one big program or lots of little ones?