|Syntactic Confectionery Delight|
Yet another "why CGI-Application" questionby punkish (Priest)
|on Nov 28, 2004 at 15:57 UTC||Need Help??|
punkish has asked for the wisdom of the Perl Monks concerning the following question:
Forgive me in advance for flogging a moribund equine, but as long as there are us n00bs (and may there be many, because that means new users of an old language are still emerging), we will continue to want light shed on old darkness. I have read the following --
I have a "run mode" param -- I typically call it "do" or "action". I also use a "target," as in "do" something to "target". This is based on my premise that all imperative sentences require at least a verb ("do") and an object ("target").
I have a "dispatch table" which maps a run mode to a sub-routine.
I separate the code from the display by using my much-loved HTML-Template.
Herein lies the problem -- CGI-App does the same things as above, and yet, I find my method cumbersome. The reason is -- I really, really want to break up my code into "one file for one run mode" because I find it very difficult to work with one, very large file -- be it a single index.cgi, or a CGI-App style Perl module.
Why don't I want to use CGI-App? Many reasons --
I would like to create a mix between what dragonchild calls "clannish" and "socialist" (see Re: Re: Why CGI::Application?). One directory per functional area, and within that, one script per run mode.
What I can't figure out is how to migrate all the common stuff to one-single external file. For example, some CGI params are common to all the scripts, so I would like to grab them all in just one place. However, most scripts will have CGI params specific to just themselves. Of course, I would like those to remain within the respective scripts. Similarly, some H-T params are common to all display screens, and I would like those to be set in one place, and then have the scripts add to the table of template params as and where needed. This is the portion I can't figure out. In other words, how to set some of the CGI and H-T params in one file, and then just use them or add to them in another file.
So, to summarize , I would like --
I don't know how to proceed. I guess, it would be really helpful to see actual applications that work similarly to above (if there are any) and learn from them.
Much appreciation awaits all advice.