mod_perl, "use lib", and stuff ...



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

.



Relevant Pages

  • How to use scripting to secure your Win2K network--some examples
    ... Software Installation script: ... The purpose of this script is to ... Let's see how service packs and hotfixes are handled in the script: ... NT4 in the way the local system account accesses network resources. ...
    (NT-Bugtraq)
  • Re: [Info-Ingres] jdbc connection problem
    ... Initially you run a setup on a clean machine with the script recording ... I obtained mixed results where there was already an installation present ... @echo starting OpenROAD installation ... Subject: jdbc connection problem ...
    (comp.databases.ingres)
  • Installation of software, and security. . .
    ... installation in Windows and various package managers. ... A setup.exe program coded by some third party such as Real Networks ... A .msi Microsoft Installer package is unpacked, and a script coded by ...
    (Bugtraq)
  • pop-forum Ready for testing: new version of PC/Linux Poplog for testing (V15.6a)
    ... This change broke the install script included with Poplog v15.6, ... I have tried to make the new installation script equally happy with ... either of which which can be run to download and install everything ...
    (comp.lang.pop)
  • V880 boot problems
    ... Configuring /dev and /devices ... Starting Solaris installation program... ... Using finish script: scripts/Finish_script ... Executing JumpStart preinstall phase... ...
    (SunManagers)