Re: Shared var between processes

Adam Prime <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <[email protected]>
On 17-10-20 05:17 AM, André Warnier (tomcat) wrote:
> On 20.10.2017 10:50, Ben RUBSON wrote:
>> On 20 Oct 2017 10:38, André Warnier (tomcat) wrote:
>>
> I believe that there is much more of a performance hit, when asking the 
> server to set up an environment ($ENV) for sub-processes, than via the 
> PerlSetVar mechanism.

You don't need to use $ENV. If you're using handlers you could use 
$r->server()->server_hostname.

You could certainly create a big hash at startup and grab stuff out of 
it that way, where the top level key is the hostname. If the data that 
you want to store is just strings though, this might be overkill. If, 
however, you want to create deeper datastructures from a somewhere, then 
this would be a perfectly acceptable way to do that. PerlSetVar is great 
with just strings, but not for anything any more complicated than that. 
It does have to be static configuration.

All the other limitations that André mentioned are completely accurate 
though.

Adam
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.