2.1. Using the perl Roll

The version of perl installed with this release of the Perl Roll is Perl 5.14.1.

The various CPAN modules that are included with this roll, are compiled and installed against the aforementioned version of Perl.

Tutorials for using Perl and its components are available from the Perl site and from CPAN

2.1.1. Perl Location

The Perl roll installs Perl 5.14.1 in /opt/perl.

All the CPAN modules that are provided in the Perl roll are also installed in /opt/perl.

2.1.2. Creating RPM from CPAN modules

The Perl roll introduces an experimental feature of creating Rocks RPMS from CPAN modules. We believe this is a better method of distributing CPAN modules across a cluster than using CPAN by hand on every single node that requires it.

With the release of the Perl roll, both Makefile.PL and Build.PL methods of building and installing CPAN modules are supported.

To build an RPM from CPAN, we will use the cpan2dist utility that comes with the core of Perl.

To build an RPM from CPAN, we need to make sure that when running cpan2dist, we don't create RPMS for modules that are already installed on the system. So we create a file called modules.ignore that contains a list of all modules that we want to ignore during a build.

The easiest way to create modules.ignore is to obtain information about installed modules from the RPMS that are already present and installed on the system.

# for i in `rpm -qa | grep -G "^opt-perl"`; do	\
	rpm -q --provides $i | grep -E "^perl\(" | \
	sed -r -e 's/^perl\(/^/' -e 's/\)[ \t]*(=[ \t]*[.0-9]+)*$/$/';
  done | sort  | uniq > modules.ignore

Now that we have our ignore list, we can try to build an RPM from CPAN. For this example, we will use the Params::Validate module from CPAN.

Example 2-1. Running cpan2dist to create Rocks RPM

# /opt/perl/bin/cpan2dist --format CPANPLUS::Dist::Rocks  \
	--ignorelist modules.ignore --buildprereq --force \
	--verbose Params::Validate
[MSG] Checking if source files are up to date
[MSG] Updating source file '01mailrc.txt.gz'
[MSG] Trying to get 'ftp://ftp.cpan.org/pub/CPAN/authors/01mailrc.txt.gz'
[MSG] Updating source file '03modlist.data.gz'
[MSG] Trying to get 'ftp://ftp.cpan.org/pub/CPAN/modules/03modlist.data.gz'
[MSG] Updating source file '02packages.details.txt.gz'
[MSG] Trying to get 'ftp://ftp.cpan.org/pub/CPAN/modules/02packages.details.txt.gz'
[MSG] No '/export/cpan/cpanplus/custom-sources' dir, skipping custom sources
[MSG] Rebuilding author tree, this might take a while
[MSG] Rebuilding module tree, this might take a while
[MSG] No '/export/cpan/cpanplus/custom-sources' dir, skipping custom sources
[MSG] No '/export/cpan/cpanplus/custom-sources' dir, skipping custom sources
[MSG] Writing compiled source information to disk. This might take a little while.
[MSG] Trying to get 'ftp://ftp.cpan.org/pub/CPAN/authors/id/D/DR/DROLSKY/Params-Validate-1.00.tar.gz'
[MSG] Trying to get 'ftp://ftp.cpan.org/pub/CPAN/authors/id/D/DR/DROLSKY/CHECKSUMS'
[MSG] Checksum matches for 'Params-Validate-1.00.tar.gz'
[MSG] RPM created successfully: /state/partition1/devel/misc/cpan/Params-Validate/x86_64/opt-perl-Params-Validate-1.00-0.x86_64.rpm
Created 'CPANPLUS::Dist::Rocks' distribution for Params::Validate to:

When you see the last line that states that the Params::Validate RPM was created successfully, and its location, you may use the RPM to install the CPAN module across your entire cluster.

The cpan2dist command in the above example has an option --buildprereq. This option builds any prerequisites that the module has, and creates RPMS for those prerequisites as well. These RPMS are in various subdirectories in your build directory.

For more information about using the cpan2dist command, please run the /opt/perl/bin/cpan2dist command without any arguments.