http://www.perlmonks.org?node_id=333201

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

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?