BlueSun System Administration


Slaying computer dragons one byte at a time

building a custom perl

Right before xmas I needed to build a perl with custom modules. In my environment we avoid customizing things like the system perl that comes with the OS. It makes rebuilding the nodes easier if they stay close to generic OS installs and customizations are put else where. I needed to install a piece of perl code for XSEDE that required custom modules. For the first time I used cpanm to do this. Cpanm was by far the least painful perl installation I have ever done. So easy. Download and compile perl. Once you have a basic perl, download and install cpanm into perl/bin. After that adding modules is as easy as

$ cpanm Module::Name

ex: $ cpanm DateTime::TimeZone

However, installing the basic CPAN bundle required this:
perl -MCPAN -e 'install Bundle::CPAN'

After that it the rest of the modules just rolled right by.

Want to make sure your perl modules are installed? Here are 2 methods.

1. cpan -l

This should list every module that is installed via cpan.

2. if you have File::Find installed, you should be able to run this:

perl -MFile::Find -MFile::Spec::Functions -Tlwe \
"find { wanted => sub { print canonpath $_if /\.pm\z/ }, no_chdir => 1 }, @INC'

This command finds the modules that are installed in the perl/site directories. The output is listed in directory format. i.e., ../DateTime/Format/pg instead of DateTime::Format::Pg.