try print B::show(), "\n";
END ------------------------------------------------------------------------------ Philip M. Gollucci (p6m7g8) [EMAIL PROTECTED] 301.314.3118 Science, Discovery, & the Universe (UMCP) Webmaster & Webship Teacher URL: http://www.sdu.umd.edu EJPress.com Database/PERL Programmer & System Admin URL : http://www.ejournalpress.com Resume : http://p6m7g8.com/Work/resume.html On Thu, 7 Feb 2002, Mike McLagan wrote: > 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 > > >