I am calling an ssi-enabled html page and it has an SSI request to a mod_perl script.
I am making a request to http://localhost/info.shtml?name=john&age=25&sex=m
Or something similar.
Now. How can I get the params passed to shtml from within mod_perl program ?
I tried the script bellow, but it only works when I call it directly and not when it's called from SSI.
I am using Apache/2.0.47 (Win32) mod_perl/1.99_12-dev Perl/v5.8.0 PHP/4.3.4 Server.
ssi and mod_perl is configured properly. I just can't get the params.
You don't show us what your info.shtml does to call the mod_perl program, but I'd guess that it does:
<!--#include virtual="/perl/whatever.pl" -->
So this is a sub-request, and you want to get the args from the main request, therefore you either need to retrieve them from the main request, e.g.:
#!/usr/bin/perl
use strict;
# remember that registy adds the sub wrapper # sub handler { my $r = shift;
unless ($r->is_main) { my $main_args = $r->main->args; $main_args = '' unless defined $main_args; # reinstall main request's args into the subreq $r->args($main_args); }
then the rest of your script as before.
or you can change your shtml file to forward the args:
<!--#include virtual="/perl/whatever.pl?${QUERY_STRING_UNESCAPED}" --> or my be this will work just fine: <!--#include virtual="/perl/whatever.pl?$QUERY_STRING_UNESCAPED" --> See: http://httpd.apache.org/docs-2.0/mod/mod_include.html#includevars
Neither of the above two has been tested. So it'd be nice if you reported back whether the two worked for you.
__________________________________________________________________ Stas Bekman JAm_pH ------> Just Another mod_perl Hacker http://stason.org/ mod_perl Guide ---> http://perl.apache.org mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com http://modperlbook.org http://apache.org http://ticketmaster.com
-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html