perl-modperl mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Stas Bekman <s...@stason.org>
Subject Re: PerlRequire's access to httpd.conf variables
Date Sun, 25 Jan 2004 02:57:48 GMT
Philip Mak wrote:
> In the following situation:
> 
> <VirtualHost 1.2.3.4>
> ServerName site1.com
> PerlSetVar Global /home/site1/global
> PerlRequire site1.pl
> </VirtualHost>
> 
> <VirtualHost 1.2.3.4>
> ServerName site2.com
> PerlSetVar Global /home/site2/global
> PerlRequire site2.pl
> </VirtualHost>
> 
> With the above example httpd.conf, is there a way site1.pl can read
> the PerlSetVar Global and see "/home/site1/global", while site2.pl can
> read it and see "/home/site2/global"? Or is this information not
> available yet during the startup sequence?

It'd be helpful if you have mentioned which mp generation you are talking 
about, Philip.

At the moment in mp2 you have no way to access the vhost server record in 
PerlRequire unless you traverse the linked list of servers. Apache->server 
gives you the base server. I think it does the same in mp1, but I don't remember.

You are much better off using Perl sections, where you are independent of 
Apache and have everything in perl, and you have a full control of what's 
happening.

e.g.:

<VirtualHost 1.2.3.4>
ServerName site1.com
<Perl>
require "site1.pl";
foo::bar::init(global => "/home/site1/global")
</Perl>
</VirtualHost>

__________________________________________________________________
Stas Bekman            JAm_pH ------> Just Another mod_perl Hacker
http://stason.org/     mod_perl Guide ---> http://perl.apache.org
mailto:stas@stason.org 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
List etiquette: http://perl.apache.org/maillist/email-etiquette.html


Mime
View raw message