Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: use CGI and die;

by diotalevi (Canon)
on Jun 10, 2003 at 16:52 UTC ( [id://264757]=note: print w/replies, xml ) Need Help??


in reply to use CGI and die;

You forgot to mention the sticky form values. It is immensely useful to be able to insert a form element into a template and have it just work correctly without lots of template-side gyrations. In fact, I'd say this is the proper way to use things like CGI::Application and HTML::Template.

sub fizzbinbox { my $self = shift; my $tmpl = $self->load_tmpl; my $q = $self->query; $tmpl->param( fizzbin => $q->checkbox_group( -name => 'words', -values=>['eenie','meenie','minie','moe'], -defaults=>['eenie','minie']) ); return \ $tmpl -> output; }

Replies are listed 'Best First'.
(wil) Re: Re: use CGI and die;
by wil (Priest) on Jun 10, 2003 at 19:25 UTC
    I'll upvote you and reply here. If you have *ever*, ever, ever found yourself writing something like:

    if ($query->param('foo') eq "bar") { do this } elsif ($query->param('foo') eq "mynameisdave") { do something completly stupid } else { ...

    Then *STOP* now and start using CGI::Application. It's the best thing since nutella on that thick bread your mum used to make and should be used at all times for any CGI application that used multiple form, pages, or any other kind of multiple foo application.

    Try it, then slate me for saying it if you don't like it. But you like that nutella, so come on, I must be right, right?

    Over and out.

    - wil

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://264757]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others studying the Monastery: (5)
As of 2024-04-25 14:58 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found