You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Denis Banovic <de...@ncm.at> on 2003/10/06 13:55:16 UTC
2 Modules with same package name
Hi!
I have 2 virtual server running 2 different applications under mod_perl.
Each application/vserver has it's own vConfig.pm
It works fine under normal CGI, but under mod_perl the vConfig.pm are mixed ( vserver 1 sometimes runs with vConfig.pm from vserver 2 or the other way around)
Is there some way to tell mod_perl not to include modules from another vserver?
I'm using ModPerl::Registry on Apache 2 & mod_perl 2.
I know I could change the name of the config-module, but IPS's must have the same problem too???
Thanks
Lust auf mehr? - http://maedls.at
---------------------------------------------------
NCM - NET COMMUNICATION MANAGEMENT GmbH
---[ Denis Banovic - CTO
mailto:denis.banovic@ncm.at
---[ Mühlstrasse 4a
AT - 5023 Salzburg
Tel. 0662 / 644 688
---[ Fax: 0662 / 644 688 - 88
http://www.ncm.at
---------------------------------------------------
Re: 2 Modules with same package name
Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2003-10-06 at 15:20, Tom Schindl wrote:
> Am Mo, 2003-10-06 um 20.15 schrieb Perrin Harkins:
> > On Mon, 2003-10-06 at 13:36, Stas Bekman wrote:
> > > But be careful with it. If you use the threaded mpm, it's all cool. If you use
> > > prefork it'll create 2 perl interpreters and more inside each httpd process
> > > gobbling up a lot of RAM, something that you don't want to do in production.
> > > It's OK for dev though.
> >
> > I wonder if we need something similar to Apache::PerlVINC for mp2 in
> > prefork mode.
>
> Why is that not appropiate?
> -------------------------8<-------------------------
> <VirtualHost ....>
> PerlOptions +Parent
> PerlSwitches -Mlib=/my/patha
> </VirtualHost>
>
> <VirtualHost ....>
> PerlOptions +Parent
> PerlSwitches -Mlib=/my/pathb
> </VirtualHost>
> -------------------------8<-------------------------
See the comment from Stas above about memory and prefork...
- Perrin
Re: 2 Modules with same package name
Posted by Tom Schindl <to...@gmx.at>.
Am Mo, 2003-10-06 um 20.15 schrieb Perrin Harkins:
> On Mon, 2003-10-06 at 13:36, Stas Bekman wrote:
> > But be careful with it. If you use the threaded mpm, it's all cool. If you use
> > prefork it'll create 2 perl interpreters and more inside each httpd process
> > gobbling up a lot of RAM, something that you don't want to do in production.
> > It's OK for dev though.
>
> I wonder if we need something similar to Apache::PerlVINC for mp2 in
> prefork mode.
Why is that not appropiate?
-------------------------8<-------------------------
<VirtualHost ....>
PerlOptions +Parent
PerlSwitches -Mlib=/my/patha
</VirtualHost>
<VirtualHost ....>
PerlOptions +Parent
PerlSwitches -Mlib=/my/pathb
</VirtualHost>
-------------------------8<-------------------------
>
> > Notice that the "correct" solution for any mod_perl and perl in general is to
> > always prefix your module packages with a unique name of a specific project,
> > like so App1::vConfig, App2::VConfig, etc.
>
> Another approach that I would use for this sort of config file situation
> is to have one module that looks at the current vhost and returns
> different data accordingly. The actual data could go in a non-Perl
> config file in AppConfig format or similar.
>
> - Perrin
>
Tom
Re: 2 Modules with same package name
Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> On Mon, 2003-10-06 at 13:36, Stas Bekman wrote:
>
>>But be careful with it. If you use the threaded mpm, it's all cool. If you use
>>prefork it'll create 2 perl interpreters and more inside each httpd process
>>gobbling up a lot of RAM, something that you don't want to do in production.
>>It's OK for dev though.
>
>
> I wonder if we need something similar to Apache::PerlVINC for mp2 in
> prefork mode.
We will need most (all?) of the mp1 tools working for mp2/prefork mpm. Notice
that Apache::PerlVINC was written to solve the problem for developers using
the same server to develop the same modules. It's not fast for production use.
So prefork/PerlOptions +Parent is probably a better solution for developers,
even though it consumes more memory.
__________________________________________________________________
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
Re: 2 Modules with same package name
Posted by Perrin Harkins <pe...@elem.com>.
On Mon, 2003-10-06 at 13:36, Stas Bekman wrote:
> But be careful with it. If you use the threaded mpm, it's all cool. If you use
> prefork it'll create 2 perl interpreters and more inside each httpd process
> gobbling up a lot of RAM, something that you don't want to do in production.
> It's OK for dev though.
I wonder if we need something similar to Apache::PerlVINC for mp2 in
prefork mode.
> Notice that the "correct" solution for any mod_perl and perl in general is to
> always prefix your module packages with a unique name of a specific project,
> like so App1::vConfig, App2::VConfig, etc.
Another approach that I would use for this sort of config file situation
is to have one module that looks at the current vhost and returns
different data accordingly. The actual data could go in a non-Perl
config file in AppConfig format or similar.
- Perrin
Re: 2 Modules with same package name
Posted by Stas Bekman <st...@stason.org>.
Perrin Harkins wrote:
> Perrin Harkins wrote:
>
>> Denis Banovic wrote:
>>
>>> Is there some way to tell mod_perl not to include modules from
>>> another vserver?
>>> I'm using ModPerl::Registry on Apache 2 & mod_perl 2.
>>
>>
>>
>> You need to run this after loading ModPerl::Registry:
>
>
> Hold on, I read your question too quickly. Your issue is with modules,
> not Registry scripts. What you need is here:
> http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_
But be careful with it. If you use the threaded mpm, it's all cool. If you use
prefork it'll create 2 perl interpreters and more inside each httpd process
gobbling up a lot of RAM, something that you don't want to do in production.
It's OK for dev though.
Notice that the "correct" solution for any mod_perl and perl in general is to
always prefix your module packages with a unique name of a specific project,
like so App1::vConfig, App2::VConfig, etc.
__________________________________________________________________
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
Re: 2 Modules with same package name
Posted by Perrin Harkins <pe...@elem.com>.
Perrin Harkins wrote:
> Denis Banovic wrote:
>
>> Is there some way to tell mod_perl not to include modules from another
>> vserver?
>> I'm using ModPerl::Registry on Apache 2 & mod_perl 2.
>
>
> You need to run this after loading ModPerl::Registry:
Hold on, I read your question too quickly. Your issue is with modules,
not Registry scripts. What you need is here:
http://perl.apache.org/docs/2.0/user/config/config.html#C_Parent_
- Perrin
Re: 2 Modules with same package name
Posted by Perrin Harkins <pe...@elem.com>.
Denis Banovic wrote:
> Is there some way to tell mod_perl not to include modules from another vserver?
> I'm using ModPerl::Registry on Apache 2 & mod_perl 2.
You need to run this after loading ModPerl::Registry:
*ModPerl::MyRegistry::namespace_from =
\&ModPerl::RegistryCooker::namespace_from_uri;
See the ModPerl::RegistryCooker documentation for more details.
- Perrin