perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dominique Quatravaux <>
Subject Re: Are global variables truly global?
Date Mon, 05 Nov 2001 08:20:52 GMT
> I have some state data that I need to persist between requests. At the
> moment these are COM objects, but they'll be ported to Perl Classes. It
> is quite important that only one of these instances exist per web
> server. These instances are too large to write and read to file on every
> request. So I have defined the variable as a package level variable.

  Package level variables are shared upon fork(), in the sense that
the memory segment(s) they use is made available to all child
processes. BUT the memory itself isn't shared, and any subsequent
write to the variable in one of the children will not reflect in the
others. So unless your state data is a constant, this is not what you want.

<< Tout n'y est pas parfait, mais on y honore certainement les jardiniers >>

			Dominique Quatravaux <>

View raw message