[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cgiapp] Is there a better C::A design pattern


Hi,

Thanks to folks on this list (and C::A::P::LogDispatch) I got my application running last night. However, I am pretty sure that I did not end up with the best way of doing it and would like comments from the list on ways I could improve it. The pattern I am using are:

sub cgiapp_prerun {
  my $self=shift;
  unless ($self->session->param('logged-in')) {
    $self->prerun_mode('start_form');
  }
}

sub some_form {
  <get $session and form params>

  unless ($form_param1 || $form_param2 ...) {
    <display the form the first time>
  }

  unless (form_logic(<form_params>, <session_params>) {
    return $self->error_page("some error message")
  }

  <save values in session if necessary>

  return $self->next_form();
}

The only time I really use the runmode on a page is to return from the error pages to the form page that called the error for a person to try again.

Appreciate any ideas, hints if there is a better pattern to use.

Thanks again for your help.

cheers,

ski


--
"When we try to pick out anything by itself, we find it
 connected to the entire universe"            John Muir

Chris "Ski" Kacoroski, suppressed, 425-681-0092

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.