Hi,

Am Samstag, 20. Dezember 2003 22:52 schrieb Paul G. Weiss:
> 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.
>

Just for the Apache::PageKit case, you can do all the startup stuff in your 
startup.pl or in a <perl> section outside of your <virtual host> section.
But now it is up to you to make sure that the A::P startup parameter match the 
perlsetvar vars.

This should work with mod_perl 1 and 2.

ie:
<perl>
 use Apache::PageKit;
 Apache::PageKit->startup('/x/z/a/my_pkit_root_for_site_foo', 'staging');
 Apache::PageKit->startup('/xxxx/yyy/my_pkit_root_for_site_bar', 'staging');
 ....
</perl>

....
<VirtualHost 1.2.3.4>
PerlSetVar PKIT_ROOT /x/z/a/my_pkit_root_for_site_foo
PerlSetVar PKIT_SERVER staging
SetHandler perl-script
PerlHandler +Apache::PageKit
</virtualhost>

<VirtualHost 10.11.11.12>
PerlSetVar PKIT_ROOT /xxxx/yyy/my_pkit_root_for_site_bar
PerlSetVar PKIT_SERVER staging
SetHandler perl-script
PerlHandler +Apache::PageKit
</virtualhost>


> -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#PerlPostConfigH
> >andler
> >
> > __________________________________________________________________
> > 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

-- 
Boris

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

Reply via email to