More interesting info...

First of all, I've upgraded to mod_perl-1.99_11 with no change.

Second, I've determined that the per-VirtualHost values are visible in the request, but not during server startup.

Here's the situation in an (I hope) easy to reproduce format:

-- config --

PerlRequire /var/www/perl/startup.pl
# set value in global scope
PerlSetVar foo global
<Location /module>
SetHandler perl-script
PerlHandler Module
</Location>
<VirtualHost 127.0.0.1:9900>
# set value in virtual host scope
PerlSetVar foo virtual
<Perl >
Module->start;
</Perl>
</VirtualHost>

-- /var/www/perl/startup.pl --

use Apache2 ();
use Apache::RequestIO ();
use Apache::ServerUtil ();
use Apache::RequestRec ();
use Apache::Const -compile => ':common';

package Module;

sub start {
     my $s = Apache->server;
     print "Module->start sees foo=" . $s->dir_config('foo') . "\n";
}

sub handler {
     my $r = shift;
     my $value = $r->dir_config('foo');
     $r->content_type('text/plain');
     $r->print("Request sees foo=$value\n");
     return Apache::OK;
}

1;

-- the output --

[EMAIL PROTECTED] pgweiss]# /usr/sbin/apachectl start
Module->start sees foo=global
[EMAIL PROTECTED] pgweiss]# access handle w/o virtual host
[EMAIL PROTECTED] pgweiss]# lwp-request http://localhost/module
foo=global
[EMAIL PROTECTED] pgweiss]# now access handle w/ virtual host
[EMAIL PROTECTED] pgweiss]# lwp-request http://localhost:9900/module
foo=virtual
[EMAIL PROTECTED] pgweiss]#


The reason this is important is that I'm trying to get Apache::PageKit to run in virtual hosts, and it depends on the availability of PerlSetVar variables on startup.


-Paul


On Fri, 19 Dec 2003 06:28:10 -0500, Paul G. Weiss <[EMAIL PROTECTED]> wrote:


I have something like this:

PerlModule Module

<VirtualHost ...>
PerlSetVar abc def
<Perl >
Module->start;
</Perl>
</VirtualHost>

and in Module.pm

use Apache::ServerUtil ()

...

sub startup
{
    my $value = Apache->server->dir_config("abc");
...
}


and lo and behold - $value is undef ! However, if I take the PerlSetVar and move it outside the VirtualHost, then $value is "def".


I'm using 2.0.47 + 1.99_10, only because I have rpms build for them (for RH9). Has this problem been noticed and fixed in the latest release? I don't see any mention of it in the mail archives.

-Paul Weiss

-- Reporting bugs: http://perl.apache.org/bugs/ Mail list info: http://perl.apache.org/maillist/modperl.html



Reply via email to