Re: Registry and mod_include - multiple invocations of a script in an SSI-parsed file

Mårten Svantesson <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
Hi Brett,

My guess is that you run into a problem of the CGI module not resetting itself between executions of your code.

As a test you could try entering the line.

CGI::initialize_globals();

explicitly in your script before calling param().

2012-01-02 22:41, Brett Lee wrote:
> Hello,
>
> First, thank you very much for your time & consideration of this problem,
>
> Have been trying to resolve an issue without success. The issue I'm seeing is that calling the same script several times within a SSI-parsed file
> causes each invocation of the script to produce the same result even though different results should be seen.
>
> To clarify, please find inlined below an example SSI-parsed file and script:
>
> <!-- file test.shtml -->
> <html>
> <head></head>
> <body>
> <!--#include virtual="/cgi-bin/test.cgi?count=5"-->
> <!--#include virtual="/cgi-bin/test.cgi?count=10"-->
> <!--#include virtual="/cgi-bin/test.cgi?count=30"-->
> </body>
> <html>
>
> #!/usr/bin/perl -w
> # test.cgi
> use strict;
> use CGI qw(-compile :all);
> my $count = param('count');
> my $a = 0;
> print header;
> while ( $a < $count) {
> print ++$a;
> }
>
> When run from the default /var/www/cgi-bin/ directory, execution works as expected; results are 1..5, 1..10 and 1..30. However, when the executable is
> run from the ModPerl Registry directory below, each invocation counts only to 5.
>
> <Directory /var/www/registry>
> SetHandler perl-script
> PerlResponseHandler ModPerl::Registry
> # PerlOptions +ParseHeaders (prevented 2+ invocations)
> Options +ExecCGI
> </Directory>
>
> Sure seems like "something" is caching part or all of the command/param. Hoping to find out what.
>
> Once again, thanks for your time & consideration.
>
> Note: previously posted at: http://www.perlmonks.org/?node_id=945804
>
> Best regards,
> - -
> Brett Lee
> Encrypt your data with PDS - http://crypto.brettlee.com/


-- 
   MÃ¥rten Svantesson
   Senior Developer
   Travelocity Nordic
   +46 (0)8 505 787 23
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.