Installing Perl modules on Shared Hosting Platforms

For shared hosting platforms where you don't have your own Perl (i.e., you have access to Perl, but not your own copy such as you'd find in a VPS or dedicated environment), you'll need to follow the instructions in perlmodinstall (i.e., download the module, unpack it, perl Makefile.PL PREFIX=~/myperl, make, make test, make install). See 'perldoc perlmodinstall' for details. perlfaq8 also has some useful advice:
       How do I keep my own module/library directory?

       When you build modules, use the PREFIX option when gener-
       ating Makefiles:

           perl Makefile.PL PREFIX=/u/mydir/perl

       then either set the PERL5LIB environment variable before
       you run scripts that use the modules/libraries (see the
       perlrun manpage) or say

           use lib '/u/mydir/perl';

       This is almost the same as

           BEGIN {
               unshift(@INC, '/u/mydir/perl');
           }

       except that the lib module checks for machine-dependent
       subdirectories.  See Perl's lib manpage for more information.

Rather than going through all your Perl programs and adding:
    use lib qw(/usr/home/foo/myperl);
to the top of each program, you can set PERL5LIB in your Apache process so that each time the CGI is run, it will find the right module: Put this in a Directory block or .htaccess file (I recommend your cgi-bin/.htaccess file since that's the only place it will be run from):
    SetEnvIf  Request_URI  "^/cgi-bin/" PERL5LIB=/usr/home/foo/myperl/lib/5.6.1:/usr/home/foo/myperl/lib/site_perl
This will add the correct paths to PERL5LIB whenever someone accesses your cgi-bin directory.

Author: Scott Wiersdorf
Modified: Tue Feb 18 11:16:52 MST 2003