We obviously do not have access to a request object during a BEGIN {}
block, but if I have a bunch of PerlSetVar things that I don't want to
re-initialize every time handler() is called for speed reasons, what is
the most elegant way to have an initialization sub that needs access to
things set in PerlSetVar? Just something like:

my $is_initialized = 0;

sub handler($) {
        ...
        unless ($is_initialized) {
                initialize($r);
                $is_initialized = 1;
        }
        ...
}

sub initialize($) {
        ...
        do stuff with $r->dir_info("thingie")
        ...
}

The problem with this is that initialize would be called for every
child, though this is better than initializing stuff at every request.

TIA

-- 
Do what thou wilt shall be the whole of the Law.
Love is the law, love under will.

PGP signature

Reply via email to