logo       

Choosing A Webhost:
A web hosting service is a type of Internet hosting service that allows individuals and organizations to provide their own website accessible via the World Wide Web. Web hosts are companies that provide space on a server they own for use by their clients as well as providing Internet connectivity, typically in a data center. Web hosts can also provide data center space and connectivity to the Internet for servers they do not own to be located in their data center, called colocation. more...

Re: Is there a better C::A design pattern: msg#00101

lang.perl.modules.cgi-appplication

Subject: Re: Is there a better C::A design pattern



Ski Kacoroski wrote:
> 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")
> }

I'd look into Data::FormValidator for that kinda validation. In
particular C::A::Plugin::ValidateRM is pretty handy.

> <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.

I usually split the display of a page and the processing of that page's
data into 2 separate run modes. Others keep them in the same one. I like
the first approach because the 2nd reminds me too much of PHP :)

--
Michael Peters
Developer
Plus Three, LP


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




<Prev in Thread] Current Thread [Next in Thread>
Google Custom Search

Recently Viewed:
krysalis.sandbo...    web.zope.zwiki/...    gnome.apps.gnum...    xfree86.newbie/...    editors.vim/200...    mozilla.enigmai...    boot-loaders.gr...    network.vnc.ult...    redhat.release....    java.geronimo.u...    os.netbsd.devel...    horde.wicked/20...    linux.lsb.discu...    ietf.ips/2005-0...    alsa.devel/2002...    user-groups.lin...    package-managem...    debian.devel.da...    security.cyrus....    video.gstreamer...   
Home | blog view | USPTO Patent Archive | advertise | OSDir is an inevitable website. super tiny logo

Free Magazines

Cisco News
Receive a free quarterly e-newsletter with exclusive articles on how Cisco IT uses its own products and solutions to enable the business.
subscribe

Systems Management News, the newspaper for IT systems administration and data center managers! Each issue of Systems Management News is chock-full of news and analysis to help you understand what's happening in your field.
subscribe

The Enterprise Newsweekly eWeek is the essential technology information source for builders of e-business.
subscribe

Oracle Magazine Oracle Magazine contains technology strategy articles, sample code, tips, Oracle and partner news, how to articles for developers and DBAs, and more. Oracle (NASDAQ: ORCL) is the world's largest enterprise software company.
subscribe

Total Telecom Total Telecom is "The Economist of the communications industry".
subscribe

Navigation