"Perl for Perl Newbies" - Part 4CPAN ModulesManual Compilation

1.1. Manual Compilation

To compile a CPAN distribution manually, you first need to download it. You can start by browsing your nearest CPAN module and downloading from there. On UNIX the following command, will download version 2.31 of the XML::Parser module.

$ wget http://www.cpan.org/modules/by-module/XML/XML-Parser-2.31.tar.gz

Next unpack it using the "tar -xvf" command:

$ tar -xvf XML-Parser-2.31.tar.gz

(if you don't have GNU tar use "gunzip" and then "tar -xvf" instead. On Windows you can use WinZip.)

Now cd to its directory and type "perl Makefile.PL" and "make".

$ cd XML-Parser-2.31
$ perl Makefile.PL
Checking if your kit is complete...
Looks good
Writing Makefile for XML::Parser::Expat
Writing Makefile for XML::Parser
$ make
cp Parser/Encodings/x-sjis-cp932.enc blib/lib/XML/Parser/Encodings/x-sjis-cp932.enc
cp Parser/Encodings/iso-8859-7.enc blib/lib/XML/Parser/Encodings/iso-8859-7.enc
cp Parser/Encodings/x-euc-jp-unicode.enc blib/lib/XML/Parser/Encodings/x-euc-jp-unicode.enc
cp Parser/Encodings/iso-8859-9.enc blib/lib/XML/Parser/Encodings/iso-8859-9.enc
cp Parser/Encodings/README blib/lib/XML/Parser/Encodings/README
cp Parser/Encodings/euc-kr.enc blib/lib/XML/Parser/Encodings/euc-kr.enc
cp Parser/Encodings/big5.enc blib/lib/XML/Parser/Encodings/big5.enc
cp Parser/Encodings/windows-1250.enc blib/lib/XML/Parser/Encodings/windows-1250.enc
cp Parser/Encodings/Japanese_Encodings.msg blib/lib/XM
.
.
.

After the wait, the module will be compiled. It is preferable to test it first, by invoking make test:

$ make test

Now you can install it, by becoming a super-user and typing make install at the command line.

$ su
Password:
# make install

Module-Build

Note that some distributions are now using Module-Build. If your distribution contains a Build.PL file, you should run the following commands instead:

perl Build.PL
./Build
./Build test
./Build install

More information can be found in the main Module-Build document


Written by Shlomi Fish