You're doing too much per runmode. Break up your processing into multiple runmodes. For instance, you should have a "display_values" runmode and a "proces_inputs" runmode that redirects (using
CGI::Application::Plugin::Redirect) back to the "display_values" runmode. (This prevents the Refresh-resubmitting problem.)
If you analyze it from a state machine POV (which is what C::A is), you'll find the number of runmodes increasing and the amount of code per runmode decreasing. Generally, I have between 4 and 8 runmodes per child class with 12 being a ceiling that should be breached only if everyone on the team agrees. I've had 2 before, but never less.
My criteria for good software:
- Does it work?
- Can someone else come in, make a change, and be reasonably certain no bugs were introduced?