in reply to Re: Review: CGI::Prototype
in thread Review: CGI::Prototype
Our app will have to figure out which button was hit and handle the data and output as needed. In C::A, there is really only one place you can put this logic: cgiapp_prerun(). If you have many runmodes that need this sort of functionalilty, your cgiapp_prerun() can start getting rather large.
Why would you not have the runmode method handle this?
I tend to use the runmode more as a vague indidactor of the expected action anyway - it determines the kind of checks that need to be done on the input, then decides which action to perform, and then refers to an output routine. Example:
sub make_report { my $self = shift; if (my $missing = $self->missing_fields()) { # back to submitted form, with missing fields highlighted return $self->make_form($missing); } # make confirmation screen. $self->template( 'confirm.tmpl' => $self->form_values, ); }
This decides the output based on wether or not all data has been filled in correctly, but it isn't really very different if you check for a button instead.
update: after reading this thread again, it seems most some people find it hard to wrap their head around the following:
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re^3: Review: CGI::Prototype
by xdg (Monsignor) on Dec 02, 2004 at 21:22 UTC | |
by merlyn (Sage) on Dec 03, 2004 at 12:44 UTC | |
by Anonymous Monk on Dec 03, 2004 at 18:46 UTC | |
by fizbin (Chaplain) on Dec 29, 2004 at 18:57 UTC | |
by xdg (Monsignor) on Dec 30, 2004 at 06:44 UTC | |
by mfuller (Novice) on Dec 04, 2004 at 21:33 UTC | |
|
runmode != page != template
by Thilosophy (Curate) on Dec 30, 2004 at 07:42 UTC |