You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by william <yi...@gmail.com> on 2008/06/24 15:07:10 UTC

mod_perl caching problem

Hello,

Before asking here, I had read a few articles in perl.apache.org about
caching issue in mod_perl, but I still don't get it right with my
program when I had already changed the input, it still giving me the
result of old input. I aware that the child process will only compile
the code for once, but I had also read somewhere that it will
recompile when it found that the file has been changed. What I want to
achieve is the program should give me the result according to the
input at that time.

#this is the main entrance of my program
use CGI qw(:standard);
print header;

use Qwerq::Core;
our $qwerq = new Qwerq::Core();
$qwerq->query("what is the population of China");

How can I solve this problem ?

Thanks.

Re: mod_perl caching problem

Posted by william <yi...@gmail.com>.
Thank you for the reply,

That's one of the articles that I had read, but still I have not found
where my code having the "my scoped variable in nested subroutines" ,
I also aware of the nature of ModPerl::Registry would handle the code
in its subrountine called "handle". I have used global variable "our"
for the variables that might caused problem.

On 6/24/08, Geoffrey Young <ge...@modperlcookbook.org> wrote:
>
>
>  william wrote:
>
> > I like to add on something, I had put the pragma
> > use strict;
> > use warnings;
> >
> > on all modules that I had, but I didn't get the warnings of "Variable
> > "$foo" will not stay shared at..." .
> >
> > What other possibility that might cause my program to cache the result
> > even when the input has already changed ?
> >
> >
>
> http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my____Scoped_Variable_in_Nested_Subroutines
>
>  --Geoff
>

Re: mod_perl caching problem

Posted by Geoffrey Young <ge...@modperlcookbook.org>.

william wrote:
> I like to add on something, I had put the pragma
> use strict;
> use warnings;
> 
> on all modules that I had, but I didn't get the warnings of "Variable
> "$foo" will not stay shared at..." .
> 
> What other possibility that might cause my program to cache the result
> even when the input has already changed ?
> 

http://perl.apache.org/docs/general/perl_reference/perl_reference.html#my____Scoped_Variable_in_Nested_Subroutines

--Geoff

Re: mod_perl caching problem

Posted by william <yi...@gmail.com>.
I like to add on something, I had put the pragma
use strict;
use warnings;

on all modules that I had, but I didn't get the warnings of "Variable
"$foo" will not stay shared at..." .

What other possibility that might cause my program to cache the result
even when the input has already changed ?

Thanks.

Re: mod_perl caching problem

Posted by william <yi...@gmail.com>.
Hello, Sorry for the late of reply, I just solve it yesterday. It's
because a module of mine is using the global variable
our @array = ();

When I migrate from CGI to mod_perl, I forgot to fix that. Now I just
understand that because mod_perl only compile once, and the subsequent
execution of global variables are remembered. So I solved it by
reseting that global variable before that global variable is used.


Thanks.

On 6/27/08, Perrin Harkins <pe...@elem.com> wrote:
> On Tue, Jun 24, 2008 at 9:07 AM, william <yi...@gmail.com> wrote:
>  > Before asking here, I had read a few articles in perl.apache.org about
>  > caching issue in mod_perl, but I still don't get it right with my
>  > program when I had already changed the input, it still giving me the
>  > result of old input.
>
>
> Are you still having trouble with this, or did you fix the problem?
>
>
>  - Perrin
>

Re: mod_perl caching problem

Posted by Perrin Harkins <pe...@elem.com>.
On Tue, Jun 24, 2008 at 9:07 AM, william <yi...@gmail.com> wrote:
> Before asking here, I had read a few articles in perl.apache.org about
> caching issue in mod_perl, but I still don't get it right with my
> program when I had already changed the input, it still giving me the
> result of old input.

Are you still having trouble with this, or did you fix the problem?

- Perrin