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.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
|
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.
|
|