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 may be to simply ask your hosting company to install it. However, many hosting companies are unwilling to install Perl modules for their clients. Fortunately there's a relatively simple workaround.
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.
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. Then, in your script, near the top, put the following 2 lines:
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.