This isn't a perl question, it's more of a design question. Anyways, for example, I have two simple run modes, one called "login" and the other called "login_submit". The "login" mode simply presents the login screen while the "login_submit" mode does the actual processing of the submitted data.

My problem is thus: if I submit 'bad data' to the login_submit form, how do I go back to the 'login' mode AND tell the what he did wrong? If cgi::app had proper mode switching my 'login_submit' mode could just set a param or something in my object and then switch to the login mode, but nope, not allowed to switch run modes.

The only way I see to change modes (aside from the prerun_mode which can only be called from one specific function) is a header-redirect, which is just ugly and inefficient. So whats the easist way of changing modes in mid run?

In reply to CGI::Application design strategy by BUU

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.