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.
When I do this kind of thing, I put the logic in the handling runmode ... something like:
# This runmode show the data-entry template sub show_entry { # ... yada yada yada } sub process_entry { my ( $self, $query ); $self = shift; $query = $self->query(); # This method will add the entry in the db $self->add_entry(); # Now if the user hit the 'add another' button... if ( $query->param( 'addanother' ) ) { return $self->show_entry(); } else { # mainscreen() being the main/home page runmode return $self->mainscreen(); } }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re^3: Review: CGI::Prototype
by hardburn (Abbot) on Dec 02, 2004 at 15:47 UTC | |
by Joost (Canon) on Dec 02, 2004 at 15:57 UTC | |
by hardburn (Abbot) on Dec 02, 2004 at 20:20 UTC | |
by Joost (Canon) on Dec 02, 2004 at 22:39 UTC | |
by hardburn (Abbot) on Dec 03, 2004 at 04:58 UTC | |
by Purdy (Hermit) on Dec 02, 2004 at 16:09 UTC | |
by hardburn (Abbot) on Dec 02, 2004 at 16:30 UTC | |
by Purdy (Hermit) on Dec 02, 2004 at 16:48 UTC | |
by demerphq (Chancellor) on Dec 02, 2004 at 18:24 UTC | |
| |
by hardburn (Abbot) on Dec 02, 2004 at 18:01 UTC |
In Section
Meditations