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

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

I don't get it - Why does CGI::Application hate me?
package run_mode_test; use strict; use base qw/CGI::Application/ ; use CGI qw/:standard/; sub setup { my $self =shift; $self->start_mode('page1'); $self->run_modes('page1' => 'page1', 'page2' => 'page2'); } sub page1 { my $self =shift; my $q = $self->query(); my $output = ''; $output .= $q->start_html(-title => 'Test Run Mode'); $output .= 'this is page1'; $output .= $q->start_form(); $output .= $q->hidden(-name => 'rm', -value => 'page2'); $output .= $q->submit(); $output .= $q->end_form(); $output .= $q->end_html(); return $output; } sub page2 { my $self =shift; my $q = $self->query(); my $output = ''; $output .= $q->start_html(-title => 'Test Run Mode'); $output .= 'this is page2'; $output .= $q->start_form(); $output .= $q->hidden(-name => 'rm', -value => 'page1'); $output .= $q->submit(); $output .= $q->end_form(); $output .= $q->end_html(); return $output; } 1;
page1 displays properly, when submitted it brings up page 2. Page2 however has the hidden rm field set to page2.