perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Chui G. Tey" <>
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
Ph:07 3250 5300
Fax: 07 3250 5399
[mailto: <> ]

View raw message