perlonk has asked for the wisdom of the Perl Monks concerning the following question:

Hi Perlmonks, Please help me as I am new to CGI. I need to design a webpage where in first page will contain radio buttons ( for choosing choices) and a submit button. when I press submit button , there should be new page opening depending on what choices i choose. How can proceed towords designing such application. Please provide me with some tutorials/links for the same. thanks

Replies are listed 'Best First'.
Re: Perl CGI - multiple pages
by graff (Chancellor) on Jun 20, 2010 at 05:02 UTC
    For the kind of thing you're talking about, I would recommend CGI::Application. The docs are very clear, the usage is fairly simple, and the result is economical code that is easy to maintain and expand.

    I had a fairly complicated app involving several pages built on just the CGI module (along with Template::Toolkit and DBI for a mysql backend). When I needed to make it more complicated with more pages, I decided to switch to CGI::Application (and continue using the same template module). The first thing I noticed was that, once I converted the original app to use this approach, I cut the amount of code I wrote by nearly half, and from that point on, expanding the app was quick work (whereas it would have been painfully difficult without this module).

Re: Perl CGI - multiple pages
by sflitman (Hermit) on Jun 20, 2010 at 04:14 UTC
    I've always used Lincoln Stein's excellent and traditional CGI module. The documentation is very good and will get you started. There's a complete example of a Forms based script which you could base your multi-radio-button page on, and the pages it generates if you direct the forms Method attribute back to the same script. Now that's the power of Perl! The major issues are making sure your test environment is reasonable, which in my opinion means Linux running Apache 2.x

    HTH,
    SSF

Re: Perl CGI - multiple pages
by scorpio17 (Canon) on Jun 21, 2010 at 14:01 UTC

    When you have multiple pages, and the content of each one depends on the one's before it, you need a way of maintaining 'state'. HTML is a stateless protocol, so this can be a little tricky. There are many ways to deal with this problem: passing data in the URL, passing data with hidden parameters, passing data with cookies, etc. But the BEST way (IMO) is to use something like CGI::Session, which plays nicely with CGI::Application, BTW. This lets you maintain state on the server side, and all you have to store client side (via cookie) is a unique session ID.