mod_perl, "use lib", and stuff ...
- From: danielmcbrearty@xxxxxxxxx
- Date: 10 Jan 2006 11:49:23 -0800
Hi perlers,
I'm developing a web based thing with mod_perl and apache. One of the
things that has bugged me has been running 2 or 3 versions of the site
(say dev and test), all using a common library "MyLib". The whole thing
is under version control, with the layout looking like this (excuse
abysmal attempt at line drawing):
projectDir
|
|
----MyLib (contains "X.pm", "Y.pm"
|
|
---- site ---- cgi --- app.cgi
Now app.cgi contains the following lines:
use lib "../..";
use MyLib::X;
(blah)
The site dir symlinks to /var/www/mysite, and at run time the intention
(which seems to work) is that a given release sees it's own MyLib, the
one in it's own projectDir.
At least that's what I thought, until I started getting odd effects
that indicated that maybe *some* of the processes were seeing a
different "X.pm". Then I read the docs and gotthis:
(snip)
Even though @INC typically includes dot ("."), the current directory,
this really isn't as useful as you'd think. For one thing, the dot
entry comes at the end, not the start, so that modules installed in the
current directory don't suddenly override system versions. You could
say use lib "." if that's what you really want. More annoyingly, it's
the current directory of the Perl process, not the directory that the
script was installed into, which makes it completely unreliable. If you
create a program plus some modules for that program to use, it will
work while you're developing, but it won't work when you aren't running
in the directory the files live in.
(/snip)
What the hell does THAT mean in teh context of mod_perl? What is the cd
of the mod_pelr process? How is this thing working at all?
And more to the point, what is a better way get the process to see the
right modules, that I can set up from an installation script? i.e I
want to export a tree from teh repository, and then run a script to set
up the symlinks correctly - for more than version of the site.
Thanks to anyone who can help unravel this knot. I can'ty be the first
to tread this weary path ...
Daniel
.
- Follow-Ups:
- Re: mod_perl, "use lib", and stuff ...
- From: nobull@xxxxxxxx
- Re: mod_perl, "use lib", and stuff ...
- Prev by Date: PDF::API2
- Next by Date: SOAP::Lite with large web service payloads
- Previous by thread: PDF::API2
- Next by thread: Re: mod_perl, "use lib", and stuff ...
- Index(es):
Relevant Pages
|
|