Dennis Stout wrote:
So in startup.perl put

my %queue_list = list_queues;
my %tech_list = list_techs;

and so on?

Then each process would get a copy of the hash?

No, those are lexicals, not globals. Something like this:


package MyCompany::Globals;
use vars qw(%queue_list %tech_list);

%queue_list = list_queues;
%tech_list = list_techs;

Then from other code you can use them as %MyCompany::Globals::queue_list.

After reading the perldoc for MLDBM, and reviewing my deadline for the project
of "today", I think I'll just use globals for now.

MLDBM::Sync is really easy to use, but if its okay for the data to be out of date then the globals thing is fine. I suggest you avoid shenanigans with killing off processes quickly, since your performance would be terrible. Instead, create a cleanup handler which runs after each request. Keep a timestamp (a global variable that will persist) in each handler of how long it's been since you last updated the data. If it's longer than 5 minutes, refresh the data. The cleanup handler runs after the client is disconnected, so it doesn't matter if it takes a few seconds.


- Perrin



Reply via email to