This is a discussion on Re: mod_perl2 and Apache::SharedMem - modperl ; Boysenberry Payne wrote: > If I created some of my static hashes and objects during the > PerlPostConfigHandler phase > and added them to either the configuration or log pools would that help > me keep > some of my ...
Boysenberry Payne wrote:
> If I created some of my static hashes and objects during the
> PerlPostConfigHandler phase
> and added them to either the configuration or log pools would that help
> me keep
> some of my memory shared, assuming I could get at either pool during the
> PerlResponseHandler?
I think you're overthinking it here and getting yourself confused.
> I have classes that create singleton objects with lots of static parts.
> Should I build these "constructs"
> on server post config so they're already built in the child processes as
> shared memory rather than
> building them in each child, increasing the non-shared memory use?
This is how this is typically done:
# in startup.pl
use My::Constructs;
# in My/Constructs.pm
package My::Constructs;
our @data = ();
# do something to build out your data structure...
Then in your application you can just access the data as
@My::Constructs::data and it will be shared by all your child processes
(assuming you don't modify it during a request).
--
Michael Peters
Developer
Plus Three, LP