Setting up perl-virtual-host handlers from startup script or handler, not from apache config, not hardcoded

Andrew Nugged <[email protected]>
Newsgroups gmane.comp.apache.mod-perl
Message-ID <CAOOP8etkuih28hCCehziXrWbdSf+dDkSFXE5gmnw1rzW45bLHg@mail.gmail.com>
I can set handlers directly from Apache config:

<VirtualHost A>
    PerlResponseHandler  code::A
</VirtualHost A>
<VirtualHost B>
    PerlResponseHandler  code::B
</VirtualHost B>

code A called only once and code B once too, only for specific Virtual Hosts.
I need to make same config from my startup perl script, I want to read
some own config data and then decide which handlers to add, which to
not. Bit if I do:

<VirtualHost A>
    <Perl>
        ...
        $s->push_handlers( PerlResponseHandler => 'code::A');
    </Perl>
</VirtualHost A>
<VirtualHost B>
    <Perl>
        ...
        $s->push_handlers( PerlResponseHandler => 'code::B');
    </Perl>
</VirtualHost B>

it presets PerlResponseHandler for code A and then code B in stack for
all requests, not for specific virtual server. That means sub-level
config's context doesn't taken into account in <Perl> sections at all
or by push_handlers routine. Anyway, doesn't work.

I want to set up own perl handlers, from perl script (i.e. through
some push_handlers-like facility) but only for specific virtual hosts,
not for all server, one handler per virtual server (code A / B), so
one mine PerlResponseHandler will act only for virtual server A,
another for B.

I don't want to make additional dispatching in every handler to
analyse, which virtual host at current request is.

Is there's a way to make some fantasy-call like 'push handler per
virtual host' from perl? (there is not, I learned API, maybe I missed
some?)
But... how to do that?

AS one pre-idea I found in API was:

<VirtualHost A>
    <Perl>
        ...
        $s->add_config(['PerlResponseHandler code::A'])
    </Perl>
</VirtualHost A>
<VirtualHost B>
    <Perl>
        ...
        $s->add_config(['PerlResponseHandler code::B'])
    </Perl>
</VirtualHost B>

but does $s->add_config works in current config context, or from
Apache config's root as $s->push_handlers?
and... intuitively I think it's not straight way. Through some strange
backdoor, right?
Maybe there's more fancy way?



P.S. I don't want to enable global request, want to make more
efficient / less memory code.

--
creator, owner and maintainer of http://www.ladoshki.com and http://patent.km.ua
my CV/about: http://patent.km.ua/eng/nugged?nc=lmp20
With respect, Andrew Nugged.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.