This is aparently the nature of Apache::Include. It executes the given script within the current request while ignoring any query string that you may provide.
So, including B from A makes all parameters supplied to A available to B, and supplying a query string to B does nothing. Moreover, calling new CGI from B will do just that. It will have the params supplied in the initial request. So, if you modify $q in script A before including B, B will not be aware of those changes made in A. Are we all completely confused now? Regards, Tim Tompkins ---------------------------------------------- Programmer http://www.arttoday.com/ http://www.rebelartist.com/ ---------------------------------------------- ----- Original Message ----- From: "Mike McLagan" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Thursday, February 07, 2002 10:59 AM Subject: Weird mod_perl & CGI.pm interaction (Bug?) Hello, I have two scripts, call them A and B. Here's what I'm doing (paraphrased heavily to save posting a huge pile of code): In data.html, I have: <!--#include virtual="A?action=show" --> In A, I have: $q = new CGI; show() if $q->param('action') eq 'show'; sub show { Apache::Include->virtual("B?action=remove"); } In B, I have: $q = new CGI; show() if $q->param('action') eq 'show'; remove() if $q->param('action') eq 'remove'; sub show { print "B::show()\n"; } sub remove { print "B::remove()\n"; } Inveriably, I end up with "B::show()" in my output, not at all what I wanted, expected or hoped for. What I see happening is that Apache::Registry is loading CGI.pm into the httpd child the first time it encounters a script that uses it. This runs a number of functions within CGI.pm which set up variables, etc. The call to new() in A then reads the query (GET or POST, doesn't matter) into @QUERY_PARAM. When B is invoked, within the same child, Apache::Registry DOES NOT reload CGI.pm and therefore does not initialize any of the variables, etc. This results in the new() call in B REUSING (!) the @QUERY_PARAM which was built up during the new() call in A! OOOPS! In order to make it work, I had to dig thru CGI.pm and found a function that's in there with comments about mod_perl around it, specifically: CGI::initialize_globals(); If I add this call in before both of the new() invocations, I get the desired, expected results. I'm not sure who to pin this on, mod_perl, Apache::Registry or CGI but it would seem to me that this qualifies as a bug, somewhere. Michael