Subject: | Post Params Conflict With Runmode |
Date: | Fri, 4 Mar 2011 10:53:49 -0600 |
To: | bug-CGI-Application [...] rt.cpan.org |
From: | Jacob Gelbman <gelbman [...] gmail.com> |
There is a problem with CGI::Application when you post a form to a page with
a runmode as in
<form method="post" action="index.cgi?rm=foo">
<input type="hidden" name="foo" value="bar"/>
</form>
You will end up at the home page rather than "index.cgi?rm=foo" because
CGI's param method ignores get params when there are post params. Heres the
fix:
--- CGI/Application.pm.orig 2011-03-04 10:48:25.611054000 -0600
+++ CGI/Application.pm 2011-03-04 10:49:19.435054000 -0600
@@ -97,11 +97,11 @@ sub __get_runmode {
elsif (ref($rm_param) eq 'HASH') {
$rm = $rm_param->{run_mode};
}
# Get run mode from CGI param
else {
- $rm = $self->query->param($rm_param);
+ $rm = $self->query->url_param($rm_param);
}
# If $rm undefined, use default (start) mode
$rm = $self->start_mode unless defined($rm) && length($rm);