Public Scratchpad | Download, Select Code To D/L |
I'd never used C::A before--though I did play with a single script, application model based on the docs. The primary reasons I want to use it is for code simplification (or at least clarity), module reuse (particularly authentication) and to hide alot of mundane cgi chores. I almost immediately realized that in order to reuse modules, I was going to have to link multiple C::As together and didn't have a clue how or where to start.
I think that if you start with the example framework from the Why CGI::Application? node, sparsely document a few of the magic statements (see the paragraph above) and then flesh out a little more of the subroutines you'll have a excellent start.
I realize you were assuming the poster was to fill in missing details, but many C::A novices (myself included) could use a few explanations or further details regarding the following:
- How do you get to the validate sub? It would help the novice to see where the run mode should be changed or a "$self->validate;" statement included (for all run modes).
- Include a brief example of what the cgi script that invokes the Applications looks like. Will it look exactly like the docs example or will there be some variation of the use/base statements?
- Are there tips for writing reusable C::As that could help prevent the novice from taking the scenic route?
- Not having a foundation in OOP can be a hindrance when trying to tackle C::A. I find myself trying to figure out which tasks should be run mode vs. non-run mode subroutines.
- What is the best way to handle the location of template files (when using multiple C::As)?
- A little more explanation about your print function would be nice. Some people may not understand the %params to @params trick. Could you explain how the print function works regarding the standard "return $output;" and add a few statements assuming HTML::Template. Just so it is functional (provided the named template exists).
That's all I can think of right now.
--Jim