Installing Perl modules on the (gs) Grid-Service
The following article will show you how to install Perl modules on the (gs) Grid-Service. You can find many perl modules by visiting http://search.cpan.org.
NOTE:
Whenever you see ##### please replace it with your site number.
You can find a list of perl modules already installed on the (gs) Grid-Service by viewing the following guide:
Find the module you want to install, We will use Acme::Tiny as a example because it doesn't have any dependencies and is easy to test: http://search.cpan.org/~dmuey/Acme-Tiny-0.4/lib/Acme/Tiny.pod
- Create a directory for your new module(s), We suggest creating the following directory: /home/#####/data/modules :
cd ~/data mkdir modules cd modules - Download your module using wget:
wget http://search.cpan.org/CPAN/authors/id/D/DM/DMUEY/Acme-Tiny-0.4.tar.gz - Now use the tar command to extract the module:
tar -xzf Acme-Tiny-0.4.tar.gz - Change into the directory:
cd Acme-Tiny-0.4 - Compile the module, making sure to use the directory created in Step 1:
perl Makefile.PL PREFIX=/home/######/data/modules/Writing Makefile for Acme::Tiny - Run Make:
makecp lib/Acme/Tiny.pm blib/lib/Acme/Tiny.pm cp lib/Acme/Tiny.pod blib/lib/Acme/Tiny.pod Manifying blib/man3/Acme::Tiny.3pm - Run Make Install:
make installInstalling /home/#####/data/modules/share/perl/5.8.4/Acme/Tiny.pm Installing /home/#####/data/modules/share/perl/5.8.4/Acme/Tiny.pod Installing /home/#####/data/modules/man/man3/Acme::Tiny.3pm Writing /home/#####/data/modules//lib/perl/5.8.4/auto/Acme/Tiny/.packlist Appending installation info to /home/#####/data/modules//lib/perl/5.8.4/perllocal.pod - Take note of where the installer placed the .pm file!!! In this case it is /home/#####/data/modules/share/perl/5.8.4. You do not need the Acme directory since that is module specific.
-
Test the module by creating the following script:
vi tinytest.pl#!/usr/bin/perl use lib qw(/home/#####/data/modules/share/perl/5.8.4); use Acme::Tiny print Acme::Tiny->VERSION(), "\n"; - Give executable permissions to the test script and run it:
chmod +x tinytest.pl ./tinytest.pl0.4 - It worked! If it did not you would receive an error message similar to this:
Can't locate Acme/Tiny.pm in @INC (@INC contains: /etc/perl /usr/local/lib/perl/5.8.4 /usr/local/share/perl/5.8.4 /usr/lib/perl5 /usr/share/perl5 /usr/lib/perl/5.8 /usr/share/perl/5.8 /usr/local/lib/site_perl .) at ./tinytest.pl line 3. BEGIN failed--compilation aborted at ./tinytest.pl line 3.
NOTE:
Note the "use lib" line. This line tells perl to include that directory when searching for modules you have included in your script. It must be placed before you try to use any modules.
Notes/Supplemental Resources:
Revisions:
2009-04-21: Article Creation
Fields marked with an asterisk(*) are required. Comment on this article