Great suggestion. I'll certainly try that.

As to why I expected PerlSetVar to be available during startup, it is because that is how it was with mod_perl1, and I wasn't considering the fact that configuration in mod_perl2 is a very different animal. I'll pass your suggestion on to the maintainer of Apache::PageKit (that is, if he doesn't read this list), because it will affect his documentation.

-Paul

On Fri, 19 Dec 2003 18:32:46 -0800, Stas Bekman <[EMAIL PROTECTED]> wrote:

Paul G. Weiss wrote:
[...]
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.

First of all, why do you expect PerlSetVar to be available at the server startup? The config phase is not completed and the value can be overriden several times by the end of config.


Second, Apache->server always gives you the global (top-level) server, so of course once you move PerlSetVar outside of vhost, you get to see its value.

I think using PerlPostConfigHandler will let you achieve what you want:

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
PerlModule Module
PerlPostConfigHandler Module::start
</VirtualHost>

package Module;

sub start {
      my($conf_pool, $log_pool, $temp_pool, $s) = @_;
      print "Module->start sees foo=" . $s->dir_config('foo') . "\n";
}

(this code is untested, but I think it should do what you want)

The difference is that you get the correct $s object here (which you can't get during the config phase). Sounds like your case can be a useful addition to the existing example:
http://perl.apache.org/docs/2.0/user/handlers/server.html#PerlPostConfigHandler


__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:[EMAIL PROTECTED] http://use.perl.org http://apacheweek.com
http://modperlbook.org http://apache.org   http://ticketmaster.com





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



Reply via email to