How To Install Perl Modules

On Shared Hosting

(For other situations, see the Perl Modules main page.)

If you need a Perl module installed on your server, the best thing to do is to simply ask your hosting company to install it.  However, some hosting companies are unwilling to install Perl modules for their clients.  Fortunately there's a relatively simple workaround that works in many cases.

You can "install" the Perl module yourself, within your own web space, just for your own CGI scripts.  To the scripts, this is exactly the same as if the module were installed server-wide.

Step 1a: install the module the easy way

All you need to do is get the module from CPAN, unzip it and find the *.pm file within it, and then put that *.pm file into your cgi-bin directory.

Step 1b: install the module the hard way

Unfortunaltely, for more complex Perl modules, there won't be a *.pm file within the file that you download from CPAN.  These kinds of modules need to be built manually on the system where they're going to be used.  Building them is still usually pretty easy, but it's a little more work.  You need to take the zip file from CPAN, unzip it, and put its contents onto your server, for example in a folder named ~/perltemp.  Then SSH into the server, cd into the ~/perltemp/modulename folder, and then run these commands:

mkdir myoutput
perl Makefile.PL PREFIX=./myoutput LIB=./myoutput
make
make install

When that's finished, you'll find a new subfolder within the myoutput folder, named something like "x86_64-linux-gnu-thread-multi".  You need to go into that folder and copy all its contents (except for perllocal.pod which you can skip) into your website's cgi-bin folder.

Step 2: tell your script where to find the module

In your script, near the top, put the following 2 lines:

use lib '.';
use lib "$ENV{DOCUMENT_ROOT}/cgi-bin";

The first line tells the script to look in the current directory for Perl modules; the second line explicitly specifies the cgi-bin directory.  One or both of those lines should work on most servers, and it doesn't hurt to add them both.

For Encodable apps like FileChucker and UserBase, they're pre-programmed to look for Perl modules in a directory called cgi-bin/perlmodules/ so you don't need to edit the script at all; just create a directory called perlmodules within your cgi-bin directory and put your modules into it.

As a final note, many Perl modules are named in 2 parts; for example, there's a module called "File::Mirror" which can be used to copy whole directories recursively.  To install this module within your perlmodules directory, you first create a subdirectory called "File", and then you put the "Mirror.pm" file into the "File" folder.  Then the module will be at cgi-bin/perlmodules/File/Mirror.pm.

Client Quotes

I just installed the demo of your product and got it up and running in no time.  I searched high and low for a decent login script and thank God I found yours.
– Adrian F.
I spent ages trying to find a way of making my own log in page for my website - if you're thinking of doing that forget it - don't waste your time!  UserBase is a 1st class product at a very reasonable price.  The software works faultlessly and can be adapted to any situation.  The service that I have received from Encodable is terrific!  I am very very impressed.  Nothing was too much trouble and I am most grateful to Anthony DiSante in particular for all his help and patience.
– Paul S.
Worked like a charm... man, this piece of software is a dream and I really appreciate all your customer service help getting this taken care of.
– Kyle M.
I just want to say you guys really stand alone in that you have a quality product and you provide genuine customer service.  It's sad but those qualities are seldom found separately, much less together.  Thanks again for your time and help.
– Alex S.
Also, I wanted to tell you that I was very skeptical about buying this script.  I've spent a lot of time and money over the past 3 months trying to find a solution that works, but I ended up having problems with so many of the scripts I tried that I was almost to the point of giving up.  But then I came across your script, and it actually does what it's supposed to.  An absolute wow.  A very impressive and powerful script indeed!  Many, many thanks!
– Mike E.
I can't thank you enough, I was up against a deadline that required me to get this up and running in 48 hours and you have probably the best customer service I've ever seen.
– Dan T.
Your scripts/software are the greatest, I mean I really love how customizable they are, how intuitive they are, and so on.  Thanks again, I love this stuff!
– Tucker O.
We searched for a long time for an application to password protect directories and allow file uploads.  Userbase & Filechucker are far superior to anything out there.  Simple yet powerful programming, extremely flexible in configuration, and great customer service.  Thanks for a superb product.
– Kat G.
Thank you VERY much for all of your help.  You've really impressed me.  We have support agreements for other software that costs thousands of dollars / year (just for the support), and most of them aren't as helpful as you have been.
– Keith Y.
There are a lot of these scripts out there, but I think they all pale in comparison to yours.
– Peter W.
The software has some great features, is well presented, runs where others are problematic and will make a good impression on our clients.  We look forward to reaping its benefits!
– Alex H.