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


in reply to Re^4: CHECKING IF HEADER DEFINED
in thread CHECKING IF HEADER DEFINED

The $self->run_modes stuff takes care of the HTTP headers for you, which is the exact problem the OP has. So its much more useful than a large conditional where you claim it is identical.

If you don't like configuring the runmodes in the setup method, you can just use CGI::Application::Plugin::AutoRunmode.

Also, once you go with CGI::Application, you immediately have all of the plugins that others have shared on CPAN so you don't have to keep reinventing wheels that have already been done better by others.