perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chui G. Tey" <chui....@advdata.com.au>
Subject Are global variables truly global?
Date Mon, 05 Nov 2001 01:19:40 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.

I have been instantiating the variable in my handler() routine if it has
not already been instantiated. ie.

package Apache::MyPkg;

my $COM_instance;

sub handler {

   if (!$COM_instance) {
       $COM_instance = Win32::OLE->new("ProgID.Class");
   }

}

Will the different child processes created by Apache share the same
variable? Or will each child create an additional instance? I'm happy to
lose the data if Apache falls over.

Chui Tey
Software Engineer
Advanced Data Integration
PO Box 660
Spring Hill QLD 4004
AUSTRALIA
Ph:07 3250 5300
Fax: 07 3250 5399
[mailto: chui.tey@advdata.com.au <mailto:chui.tey@advdata.com.au> ]
 

Mime
View raw message