Hi All

I have a mod_perl module in which I am trying to make use of package
globals for relatively static data. The code is in essence the following:

package Apache::repsys;
#File Apache/repsys.pm

use strict;
use Apache::Constants qw(:common);

my ($var1, $var2);

sub handler {
my $r = shift;

#generate string with org_cd selections HTML
&set_var1($r, \$var1) unless defined $var1;

...

}

sub set_var1
{
my $r = shift;
my $var1_ref = shift;

$r->log_error("Setting var1");
$$var1_ref = "HTML string here";
}

Accorging to (my understanding of) the Apache Modules book, $var1 should
stay set between calls to handler() (cf. Apache::ESSI). The module works
great except that my logs show set_var1() is getting hit every time the URL
is accessed, which is bad because the HTML string is set up by a
substantial call to a backend database. What am I missing/confusing?

Thanks in advance

Bill


Reply via email to