I understood the limitation of the single interpreter, the problem again
was to append to @INC per VirtualHost.

For example,

Application A: running on server 1 has its lib directory at
/data/appA/lib/. Its lib packages are in namespace "AppA::" (to prevent
overlap in the single Perl interpreter).
Application B: running on server 1 has its lib directory at
/opt/appB/server/lib. Its lib packages are in namespace "AppB::".

The same applications when deployed on server 2, might or might not have
the same absolute path to their lib directory. So, for example AppA's
lib on server2 might live at /data4/servers/AppA/lib.

The historical reason for the differences in path aren't important, just
assume I can't fix them :-). Since all app's are segregated into
namespaces for their packages, a single interpreter is OK, there is no
overlap (we made that change specifically to support mod_perl).

The goal was to be able to checkout the application source from our CVS
repository, "Include" its "app.httpd.conf" from the main httpd.conf, and
be ready to go, with the absolute path for each application's lib
directory appended to @INC for StatINC to work.

Obviously in order for that to work each App's startup.pl would need to
be able to determine its path as it is PerlRequire'd, so it can build
the needed path to the lib directory. Wihtout FindBin this doesn't work
under mod_perl. <Perl> sections appeared to be capable of doing it
(since the app.httpd.conf was located in the source tree of the app we
could use $0 to find the path to app.httpd.conf) but attempting to do
too much in a <Perl> section seemed to constantly cause breaks (I
eventually gave up). 

As I mentioned previously we switched to absolute paths in the
per-application startup.pl file. Its a pain to maintain a per-server
times per-application list of lib paths, but that fixes us until I get
to see what mod_perl 2.0 has in store for me :-)

Thanks again for all the responses,

Alex

 

> -----Original Message-----
> From: Perrin Harkins [mailto:[EMAIL PROTECTED]]
> Sent: Friday, September 21, 2001 8:06 AM
> To: Alex Harper; Stas Bekman
> Cc: [EMAIL PROTECTED]
> Subject: Re: Setting PerlRequire in a <Perl> section
> 
> 
> > Actually, yes, I had. PerlVINC is not really what I needed, 
> the goal was
> > not to reload %INC per VirtualHost, the need was to have a single
> > PerlRequire set up @INC properly per VirtualHost (so Apache::StatINC
> > would work). Ordinary this would have been done with 
> something like 'use
> > lib "$FindBin::Bin/lib/", but since that doesn't work under 
> mod_perl I
> > was toying with using <Perl> sections.
> 
> It sounds like maybe you were not understanding that in the 
> mod_perl 1.x
> series there is only 1 Perl interpreter shared between all 
> VirtualHosts
> (they are virtual, after all).  That means there can only be 
> one @INC for
> all VirtualHosts as well.  Things like PerlVINC cheat by 
> messing with @INC
> on each request.
> 
> - Perrin
> 
> 

Reply via email to