Tuesday, December 26, 2006

Compiling & Installing a perl module

This is a basic but essential tip on how to install a perl module

First of all, get the perl module via http://search.cpan.org

For example - XML::Twig

wget http://search.cpan.org/CPAN/authors/id/M/MI/MIROD/XML-Twig-3.26.tar.gz

Extract it

tar zxvf XML-Twig-3.26.tar.gz

Now execute the following steps

perl Makefile.PL (Create the makefile)
make (compile the module)
make test (test the module)
sudo make install (install the module)

You can also use perl Makefile.PL PREFIX=/opt/perl/modules

to install your module at a different location - /opt/perl/modules

No comments: