You are viewing a plain text version of this content. The canonical link for it is here.
Posted to modperl@perl.apache.org by Perrin Harkins <pe...@elem.com> on 2003/04/03 01:07:01 UTC

Re: best way to configure for multiple developers?

Brian C. Thomas wrote:
> I have read through the lists looking for issues related to mp2 and
> @INC, and have read the part about "+Parent" and virtual hosts.

You should read the docs for tips on this, especially here:
http://perl.apache.org/docs/general/control/control.html#Starting_a_Personal_Server_for_Each_Developer

The strategies for this are mostly unaffected by mp 1 vs 2.

> Is there a "best" way to configure the apache/mp2 setup so that there
> doesn't have to be constant additions to "startup.pl" to adjust the
> INC path?

If you don't need to restart the server, you could give each developer a 
separate virtual host with a separate pool of perl interpreters.  These 
could each have a different @INC setting and would not share code.  If 
you need people to be able to restart though, it has to be separate servers.

> For example, I want developer1 to use /dev1, and developer2 /dev2.  I
> want each developer to be able to build functions below there
> directories in as many subdirectories as projects they have going on.
> I don't want developer1's "functions.pm" code to interfere with
> developer2's "functions.pm".

Well, what I mentioned above will let you do that, but how do you do it 
on the production server?  You probably don't want to have multiple 
pools of interpreters there, since it would use more memory.  If you 
keep these files in a separate namespace, it won't be an issue.  Are 
these real modules, with package declarations?

> Is such an arrangement even possible under mp2?  I've been using
> Apache1/mp1 and this works fine

How are you doing it in mp1?  There is no support for pools of 
interpreters in mp1, so all of your code must be using the same @INC.

- Perrin


Re: best way to configure for multiple developers?

Posted by Stas Bekman <st...@stason.org>.
> Right, I guess it just "feels" like it is working under mp1, since I
> can get @INC to contain "." (the current dir) and use StatINC in all
> the developer locations.  In the mp2 server, it shows me a different
> @INC, that doesn't include "." (is it possible in mp2?).

You almost got me ;) I was looking for the place in mp2 that removes "." from 
@INC. After awhile it struck me to check the perl source, and perl.c had:

     if (!PL_tainting)
	incpush(".", FALSE, FALSE, TRUE);

It's been there for a long time (tested with 5.005_03), though I didn't 
know/remember that :(

# here you have "."
% perl -le 'warn join "\n", @INC, "";'
# and here you don't
% perl -Tle 'warn join "\n", @INC, "";'

"." is added to @INC only if you aren't running with -T. Nothing specific to 
mod_perl.

You can still add it using:

use lib qw(.);

if you really have to. But it's especially bad idea with mp2/threaded mpm, 
where one should never use chdir during request time and rely on cwd. See:
http://perl.apache.org/docs/2.0/user/coding/coding.html#Thread_environment_Issues

__________________________________________________________________
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: best way to configure for multiple developers?

Posted by "Brian C. Thomas" <bc...@nature.Berkeley.edu>.
Hi

Thanks for the info.  I'll try setting up some virtual hosts.  More
below...

On Wed, Apr 02, 2003 at 06:07:01PM -0500, Perrin Harkins wrote:
> Brian C. Thomas wrote:
> >I have read through the lists looking for issues related to mp2 and
> >@INC, and have read the part about "+Parent" and virtual hosts.
> 
> You should read the docs for tips on this, especially here:
> http://perl.apache.org/docs/general/control/control.html#Starting_a_Personal_Server_for_Each_Developer
> 
> The strategies for this are mostly unaffected by mp 1 vs 2.
> 
> >Is there a "best" way to configure the apache/mp2 setup so that there
> >doesn't have to be constant additions to "startup.pl" to adjust the
> >INC path?
> 
> If you don't need to restart the server, you could give each developer a 
> separate virtual host with a separate pool of perl interpreters.  These 
> could each have a different @INC setting and would not share code.  If 
> you need people to be able to restart though, it has to be separate servers.
> 
> >For example, I want developer1 to use /dev1, and developer2 /dev2.  I
> >want each developer to be able to build functions below there
> >directories in as many subdirectories as projects they have going on.
> >I don't want developer1's "functions.pm" code to interfere with
> >developer2's "functions.pm".
> 
> Well, what I mentioned above will let you do that, but how do you do it 
> on the production server?  You probably don't want to have multiple 
> pools of interpreters there, since it would use more memory.  If you 
> keep these files in a separate namespace, it won't be an issue.  Are 
> these real modules, with package declarations?
> 
> >Is such an arrangement even possible under mp2?  I've been using
> >Apache1/mp1 and this works fine
> 
> How are you doing it in mp1?  There is no support for pools of 
> interpreters in mp1, so all of your code must be using the same @INC.

Right, I guess it just "feels" like it is working under mp1, since I
can get @INC to contain "." (the current dir) and use StatINC in all
the developer locations.  In the mp2 server, it shows me a different
@INC, that doesn't include "." (is it possible in mp2?).

Thanks again,

BCT