This is just a blog to try and spread some of the knowledge that has been freely given to me by the wider community, without which I'd get absolutely nothing accomplished. I hope this benefits some of you out there.

Friday, August 14, 2009

CPAN, Perl's Mothership



I recently wrote post about setting up a new mail server and how during that process I needed to install cpan as well as compile and install a perl module from source.

1. Download the zip/tar archive and uncompress e.g. tar xzvf my-perl-module.tar.gz

2. cd my-perl-module. Read the README and INSTALL files.

3. Run perl Makefile.pl PREFIX=/my/perl/directory.

4. Run 'make' and then 'make test'

5. Run 'make install'

6. Enjoy your new, bitchingly cool, perl module.

If this explanation is inadequate or you want a second opinion, check out cpan for more detailed, and probably correct, instructions.

On a related note, you can install modules using cpan itself. cpan was already installed, but not configured, with CentOS 5, but any modern version of linux will either come with it or have a way to easily install with apt-get/yum, etc.

The configuration I did was just the default, but I did have to install gcc before I could finish.

Once you do finish configuring cpan, to run it is dead easy: cpan

Running 'help' will get you a list of commands for the cpan shell. I just used it for installing modules so all that was necessary is just entering 'install your_desired_module' e.g. 'install DBI'

You can find the exact name of the module you need at search cpan.

That should take care of everything for you.

No comments:

Post a Comment

Followers