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


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

Working on the assumption that you would already have one sub per action (which probably calls several other subs in turn) and merely use the id/elsif/sleif/else to decide which to dispatch to, then I still fail to see what benefits CGI::Application gives you.

From the documentation, you are expected to do this:

sub setup { my $self = shift; $self->start_mode('mode1'); $self->mode_param('rm'); $self->run_modes( 'mode1' => 'do_stuff', 'mode2' => 'do_more_stuff', 'mode3' => 'do_something_else' ); }
which really is just another way of writing this:
if ($cgi{rm} eq 'mode1') { do_stuff } elsif($cgi{rm} eq 'mode2') { do_more_stuff } ...
it's just different boilerplate.