<?xml version="1.0" encoding="windows-1252"?>
<node id="363830" title="jlongino's scratchpad" created="2004-06-13 09:56:05" updated="2005-07-19 01:08:57">
<type id="182711">
scratchpad</type>
<author id="95917">
jlongino</author>
<data>
<field name="doctext">
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.
&lt;p&gt;
I think that if you start with the example framework from the [Why CGI::Application?] node, sparsely document a few of the &lt;i&gt;magic&lt;/i&gt; statements (see the paragraph above) and then flesh out a little more of the subroutines you'll have a excellent start.&lt;/p&gt;
&lt;p&gt;
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:&lt;/p&gt;
&lt;ul&gt;&lt;li&gt;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-&amp;gt;validate;" statement included (for all run modes).
&lt;li&gt;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?
&lt;li&gt;Are there tips for writing reusable C::As that could help prevent the novice from taking the scenic route?
&lt;li&gt;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.
&lt;li&gt;What is the best way to handle the location of template files (when using multiple C::As)?
&lt;li&gt;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).&lt;/ul&gt;
&lt;p&gt;That's all I can think of right now.&lt;/p&gt;
&lt;p&gt;
--Jim
&lt;/p&gt;</field>
</data>
</node>
