Mailing List Archive

Oddity with a set of variables
A little preface:
Server version: Stronghold/2.4.2 Apache/1.3.6 C2NetEU/2410 (Unix)
mod_perl/1.21 ApacheJServ/1.0
Server built: Dec 10 1999 10:55:44

I have a set of variables I've created in a module which I load at startup.

PerlModule OurStuff::Util

There are a set of scripts (4 or 5) that are using this modules to maintain
information about users in big fat hash. This was mostly done to avoid
having to do 5-10 queries every time someone accessed a page.

I have a hash I call OurStuff::Util::ADDRESS and a hash I call
OurStuff::Util::USER. The "USER" hash contains another dimention called
{'ADDRESS'} which contains a list of all the address_id's that that user is
assigned to...

So $OurStuff::Util::USER{<user_id>}{'ADDRESS'} = "123,4342,123235".

On the address page, when it loads it often doesn't contain valid
information. It seems like the USER hash is only shared on a per-child
basis and not globally. Perl-status shows that the modules are loaded and
the variables. A gaze at the module shows that indeed "use vars qw{$USER
$ADDRESS};".

If I add a new address, and reload the page which shows the address, I still
have the old information... that is, until i work my way back around to the
child in which I assigned the new address...

The fairly odd thing about all of this: it just started happening today...
and RCS shows no changes in the past 48 hours. I'm going to try using
Exporter (instead of just 'use vars'), but from everything I've read, 'use
vars' should work the way I want it...

Thanks,
CK
Re: Oddity with a set of variables [ In reply to ]
There is a problem with that. The different instances
of Apache have access to different variables UNLESS
you are using Win32.

The solution for forked apache children is
IPC::Shareable