in reply to Persistent memory with mod_perl and a module.

With mod_perl, i get a one digit number that changes randomly (random = "jameshasnoclue"). I read about this in the mod_perl documentation.

If you read about it then you understand that Apache forks servers to handle requests and that each process has its own embedded perl interpreter and each intepreter has its own copy of the variable. So, if you want them to all share and/or modify the same value, then you need to store the value outside of the process and make sure that all of the processes update it in an orderly manner.

A common way to do that is to put the value in a file and then have your script use voluntary locking for access to it. If this is primarily a learning experience, it would probably be worthwhile for you to implement that. If you just want to get it working, there is likely to be a module available on CPAN that would help, though I don't know which.

-sauoq
"My two cents aren't worth a dime.";
  • Comment on Re: Persistent memory with mod_perl and a module.