perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Ben RUBSON <ben.rub...@gmail.com>
Subject Re: Shared var between processes
Date Thu, 19 Oct 2017 19:57:15 GMT
Nice, perfect, just tested, working perfectly !
Thank you very much Adam !

Ben


On 19 Oct 2017 18:39, Adam Prime wrote:

> If it doesn't need to change then you should be able to set it in  
> PerlPostConfigRequire code, and it will then be available to all children  
> in copy on write memory (ie any change will only affect the process that  
> changed it.)
>
> https://perl.apache.org/docs/2.0/user/handlers/server.html#Startup_File
>
> Adam
>
>
> On 17-10-19 12:11 PM, Ben RUBSON wrote:
>> Hi,
>> I'm trying to share a var between the different processes of my prefork  
>> Apache.
>> I then tried the following idea :
>> $r->server()->dir_config('var','val');
>> Unfortunately, $r->server()->dir_config('var') is not shared among the  
>> processes.
>> I would have thought config was stored at the very first Apache process  
>> (the parent) level.
>> Other solution is IPC::Shareable (one more module to load :-/)
>> Any other solution ?
>> I would have been happy with an Apache-only way to do this (like I tried  
>> above).
>> I need the var to be set only one time to a constant random value, then  
>> to be read by the different processes.
>> I then also thought about an environment variable set when Apache  
>> starts, and then given to Perl using "PerlSetVar var ${VAR}".
>> But 1. var value would be disclosed into Apache env which I want to  
>> avoid, 2. PerlSetVar at every request is perhaps not really perfect in  
>> terms of performance.
>> Thank you very much for your help !
>> Ben



Mime
View raw message