An alternative I have thought of would be to re-use the same runmode, and check the value of the submit button which would tell me the user submitted the form. So each run mode function would handle displaying the form if the user has not submitted it, otherwise it would process the data.

You need to be careful about using the value of the submit button for tasks like this. In some broswers, pressing the enter key while a form element is active will submit the form, but the value of the submit button is not passed, as it was not physically clicked.

It is better to add a hidden field into the form that you can look for when checking to see if the user submitted a form.

As for your actualy question, I have used both techniques successfuly with CGI::Application, so it is really a matter of personal preference which method you choose to use.

- Cees


In reply to Re: Question about designing a web app using CGI::Application by cees
in thread Question about designing a web app using CGI::Application by disciple

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.