[Templates] Apache::Template 0.08 bug? (CGI.param() vs. %params)

Randal L. Schwartz merlyn@stonehenge.com
19 Oct 2003 09:53:32 -0700


>>>>> "Jeff" == Jeff Anderson <captvanhalen@yahoo.com> writes:

Jeff> The following template:
Jeff> [% USE CGI %]
Jeff> [% CGI.start_form  %]
Jeff>     Foo: [% CGI.textfield('foo') %]<br/>
Jeff>     [% CGI.submit('go') %]
Jeff> </form>
Jeff> [% IF CGI.param('go') %]
Jeff> you submitted this: [% CGI.param('foo') %]
Jeff> [% END %]

Jeff> is not working for me under Apache::Template
Jeff> (version 0.08 - haven't tried older versions). By
Jeff> "not working" i mean the form is printing just
Jeff> fine, but CGI.param is not appearing to contain
Jeff> any submitted parameters. That is, the IF block
Jeff> is evaluting to false.

Either CGI.pm or the CGI plugin is at fault, at least in some
circumstances.  Apparently, running under Apache::Template
is not considered to be running under "mod_perl", so CGI.pm
doesn't set/reset the params from the env-vars.  I have seen
this in production, but have not reduced it to a test case,
so I've not submitted a bug yet.  But if you look at the source
for CGI.pm, you can see that it goes into a special mode for
running from Apache::Registry, but obviously those same
variables are not provided in Apache::Template.

Hmm.  Maybe Apache::Template is at fault, if it's trying to act
like registry for the top-level page?

Anyway... param() and CGI.pm and Apache::Template *do not mix*
in the current setup.  Stay away from them.

-- 
Randal L. Schwartz - Stonehenge Consulting Services, Inc. - +1 503 777 0095
<merlyn@stonehenge.com> <URL:http://www.stonehenge.com/merlyn/>
Perl/Unix/security consulting, Technical writing, Comedy, etc. etc.
See PerlTraining.Stonehenge.com for onsite and open-enrollment Perl training!