[cgiapp] Multiple run modes

David Baxter david at sitesuite.com.au
Thu Feb 7 04:04:50 EST 2008


Hi Mike,

My preferred way is to simply call the view runmode after the update has 
completed. That way you can pass variable or parameters back to the view 
to prompt a message to be displayed.

e.g.

sub update {
    my $self = shift;
    # update the record
    ...
    # set a message to be displayed in the view runmode
    my $message = "The $id record was successfully updated.";
    return $self->view($message);
}

Regards,

David

Mike Tonks wrote:
> Hi,
>
> I'm looking at CGI::Application prior to use, and one thing is unclear to me.
>
> I'll outline a little senario to demonstrate the question:
>
> I have a simple app with four run modes - list, view, edit & update
>
> list does what it say on the tin - lists records in a data table
>
> view ditto, displays a single record
>
> edit displays a form to edit (or add) a record
>
> update sends the posted data to the database
>
>
> In my example, I would like the update run mode to then call the view
> run mode, rather then simply display a rather useless 'update
> complete' message.
>
> Is there a good way to do this with CA?  I  suppose a simple option is
> to simply have update() call view() and return the results, but I
> wondered if there was a preferred solution to this?
>
> Another thought that occurred from scanning the docs would be to put
> the update function in prerun, but this seems wrong somehow.
>
> Thanks for any assistance,
>
> mike
>
> #####  CGI::Application community mailing list  ################
> ##                                                            ##
> ##  To unsubscribe, or change your message delivery options,  ##
> ##  visit:  http://lists.openlib.org/mailman/listinfo/cgiapp    ##
> ##                                                            ##
> ##  Web archive:   http://lists.openlib.org/pipermail/cgiapp/   ##
> ##  Wiki:          http://cgiapp.erlbaum.net/                 ##
> ##                                                            ##
> ################################################################
>
>
>
>
>   


More information about the cgiapp mailing list