Guten Tag Thorsten Schöning, am Montag, 5. August 2019 um 19:18 schrieben Sie:
> The problem is that I'm having trouble how to find the VHOST > currently executing that handler. The only thing which came into my mind is using environment variables per VHOST like in the following examples: > PerlSetEnv SOME_ID "0c8c1236-86de-4483-9d4b-999e2cfd17c1" > PerlPostConfigRequire "Some.pm" Each VHOST gets it's own ID and that environment variable seems to be uniquely available during execution of the configured package: > [Mon Aug 05 20:50:32.181559 2019] [:warn] [pid 17736:tid 704] [...]: > 0c8c1236-86de-4483-9d4b-999e2cfd17c1: 1 > [Mon Aug 05 20:50:32.836195 2019] [:warn] [pid 17736:tid 704] [...]: > 9dc691d6-794a-4095-852e-e596cabf43d5: 1 > [Mon Aug 05 20:50:34.180453 2019] [:warn] [pid 17736:tid 704] [...]: > 0c8c1236-86de-4483-9d4b-999e2cfd17c1: 2 > [Mon Aug 05 20:50:34.830098 2019] [:warn] [pid 17736:tid 704] [...]: > 9dc691d6-794a-4095-852e-e596cabf43d5: 2 > The logging code: > my $server = Apache2::ServerUtil->server(); > $server->warn(__PACKAGE__ . ": $ENV{'SOME_ID'}: " . > Apache2::ServerUtil::restart_count()); With that in mind, one can get all VHOSTs and search for the ID they define. It's important to note that `lookup` is not of much help here, it doesn't seem to support searching for `PerlSetEnv` directly, but one needs to implement that on hash refs returned for the VHOSTs manually: > my $confTree = Apache2::Directive::conftree(); > my @vhosts = $confTree->lookup('VirtualHost'); Each result is a hash ref containing keys and values like the following: > $VAR1 = {\n 'PerlSetEnv' => 'AMS_MOD_PERL_PRE_LOADING_ID > "9dc691d6-794a-4095-852e-e596cabf43d5"',\n[...] The structure of the hash ref depends on the actual config, so it might contain additional child hash refs I guess. Any better ideas welcome... Mit freundlichen Grüßen, Thorsten Schöning -- Thorsten Schöning E-Mail: thorsten.schoen...@am-soft.de AM-SoFT IT-Systeme http://www.AM-SoFT.de/ Telefon...........05151- 9468- 55 Fax...............05151- 9468- 88 Mobil..............0178-8 9468- 04 AM-SoFT GmbH IT-Systeme, Brandenburger Str. 7c, 31789 Hameln AG Hannover HRB 207 694 - Geschäftsführer: Andreas Muchow