Providing Perl on a shared web server

Nik Clayton nik at
Fri Jan 20 08:24:37 PST 2006

Dave Evans wrote:
> I'm currently in the process of setting up a new shared web server (virtual
> hosting for many web site, probably eventually in the realm of 200-1000
> sites).  This server runs Apache, and supports the use of CGI scripts,
> including those written in Perl.
> My question is, do you have any insight into how I might manage issues
> relating to versions of Perl, and versions / availability of CPAN modules?

Out of the box Perl doesn't support this sort of thing very well.  Every 
solution I've seen is a variant of the same theme -- munge module 
installation so that each module installs in to a path that includes the 
module's version number.

Then make sure that every module that wants to use another module doesn't do:

   use Foo::Bar;

but does

   use lib '/path/to/Foo/Bar/version/x.y';
   use Foo::Bar;

Then, if you have multiple copies of Foo::Bar installed, one of them goes in 
/path/to/Foo/Bar/version/x.y, another goes in to 
/path/to/Foo/Bar/version/a.b, and so on.

This is a pain because nothing on CPAN expects this sort of thing.

There is a module on cpan, "only", which aims to make this sort of thing 
easier to manage.  But it doesn't change the fact that you need to patch 
every third party module you use.

A related solution -- are you providing shell accounts for your users?  If 
so, you could build a custom version of Perl that's configured to install 
modules in $HOME/lib, and to look for non-core modules in $HOME/lib too. 
Then it's your user's responsibility to install whatever modules they need. 
  You take the disk space hit if multiple users all install the same module, 
but disk space is cheap, and modules are normally tiny.


More information about the MiltonKeynes-pm mailing list