perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jeremy Silva <jsi...@mitre.org>
Subject Re: Weird CGI Caching problem
Date Wed, 14 Apr 2004 17:07:36 GMT
Perrin,

I'd be interested to see how this would work though, given my original 
code post and your modifications.  The following code will cache the CGI 
parameters with Mod_perl.  Switching to CGI::Simple was the only 
solution that I could find.

JS



mycounter.pl
_________________
   use CGI;
   my $counter;

   sub run{
     my $cgi = shift;
     print "Content-type: text/plain\r\n\r\n";
     print "HERE";
     $counter = 0;
     for (1..5) {
       increment_counter();
     }
         $cgi=null;

   }
   sub increment_counter{
     $counter++;
     my $str=$cgi->param("name");
     print "Name=$str Counter is equal to $counter !\r\n";
   }
   1;


counter.pl
_____________
   use strict;
   require "./mycounter.pl";
   my $cgi = CGI->new();
   run($cgi);


Perrin Harkins wrote:

> On Fri, 2004-04-09 at 12:00, Jeremy Silva wrote:
> 
>>The simple answer, is to not use the default CGI.pm module, but instead 
>>use the CGI::Simple module instead.  From what I've read, it is faster 
>>than the default CGI module.
> 
> 
> Glad to hear CGI::Simple is working for you.  CGI.pm's mod_perl support
> is somewhat tricky, because it uses a lot of global variables.  However,
> it does work.  If it didn't work for you, it was probably due to a
> scoping problem somewhere in your code, like an unintentional closure. 
> If you have further problems with apparent caching, look for something
> like that.
> 
> - Perrin
> 
> 
> 


-- 
Report problems: http://perl.apache.org/bugs/
Mail list info: http://perl.apache.org/maillist/modperl.html
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message