Home : HTML : Character Codes

Using Non-Standard Perl Modules With Freeola Web Hosting

Introduction

I’ve been trying for a while to get some Perl modules that are not shipped with the standard installation working with my web hosts, Freeola. Freeola are generally very good, and I wouldn’t hesitate to recommend them but their Perl support is somewhat lacking and they do not provide ssh access.

I contacted tech support a while ago to ask them to install a couple of modules from CPAN but they refused saying that they had experienced problems with hackers installing Perl modules before. Hmmm.

So I finally figured out how to get the modules I wanted working on my site and this document contains the low down.

Shell Access

To get around the problem of not having any ssh access, I installed Martin Geisler’s excellent PHP Shell. As he explains in the accompanying documentation, this can be a bit of a security risk, so I always make the directory unreadable when I've finished with it.

Anyway, once installed PHP Shell gives you a rudimentary shell so you can easily execute simple commands but note that wildcards and filename completion won’t work. Now we have our shell, we can get on with installing the modules.

Source Code

Download the source code for the module(s) you require from CPAN - the link to a gzipped tarball can usually be found at the top right of the modules documentation page. Upload it to your Freeola account using FTP and unzip/untar it using the PHP Shell.

The build process needs to write to the unpacked directory, so use your FTP client to make the new directory writable by all. It needs world write permissions because the commands you pass via PHP Shell are executed as the webserver user, i.e. nobody.

A Note About Directory Structures

You’ll probably want to install more modules in the future, so it’s worth putting a good strategy in place now to save time and hassle later. I created a new directory called “cpan” at the same level as my “htdocs” and “cgi-shl” directories. This is where the installed modules will go so you must make it world-writable using your FTP client.

Freeola users will be aware of the slightly complicated usernames and directory names imposed on them by the ISP. Usernames usually look something like sr0123456, with the associated directory being /freeola/users/6/5/sr0123456. There is more about this in their support documentation.

Throughout the rest of this document, I’ll be using sr0123456 in the examples. Remember to change this for your own username.

Building & Installing the Modules

So, the source code is unpacked and ready to be built - let’s get to it!

To build the module, you need to get perl to build a makefile using a command like this:
perl -I/freeola/users/6/5/sr0123456/cpan Makefile.PL LIB=/freeola/users/6/5/sr0123456/cpan PREFIX=/freeola/users/6/5/sr0123456/cpan

Any missing dependencies will be flagged up at this stage and you'll need to install them before continuing. Annoying, but not insurmountable.

Once the makefile has been created successfully, make it:
make

If it all built OK, and most should, test it:
make test

I’ve found that the tests do not always work as expected (maybe something to do with PHP Shell?) so if you see errors, review the output and make a judgement call. I’ll update this page if I get any more information.

Assuming you’re happy with the test results, let’s install the module:
make install

The installation process will complain that it is unable to install the man pages under /usr/local. This is not a problem.

Writing Scripts That Use the New Modules

That was a lot of work just to get the bloody things installed, let’s make them work hard for us now.

We need to get the path to our new modules added to @INC. There are lots of ways to do this, but my favourite is to add the following line to the beginning of my scripts:
use lib qw(/freeola/users/6/5/sr0123456/cpan);

That’s it, good luck and if you have any related tips, please leave a comment below.

Comments

Members have left 1 comments about this page:
I've recently discovered CGIPan by the very talented Tinita. After a bit of messing around with the configuration, this tool saved me a  load of time, as I had around 30 modules and dependencies to install.
 
Unfortunately, the Perl installation at Freeola languishes at 5.00503, which is causing me loads of problems. If you are a Freeola customer and want them to upgrade their Perl installation, please add your voice here.

Posted by Andy at May 22nd, 2007, 9:27pm
Please Login or Register to comment on this page.

Resources
Tools
User
Last Updated Saturday, 06-Jan-2007 10:15:07 GMT