Follow

Installing Perl modules on the Grid

  • Applies to: Grid
    • Difficulty: Medium
    • Time Needed: 20
    • Tools Required: SSH, vi knowledge

Overview

The following article will show you how to install Perl modules on the Grid. 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 Grid by viewing the following guide:

Instructions

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.

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.

  1. Create a directory for your new module(s). We suggest creating the following directory: /home/#####/data/modules:
    
    cd ~/data
    mkdir modules
    cd modules 
    
  2. Download your module using wget:
    
    wget http://search.cpan.org/CPAN/authors/id/D/DM/DMUEY/Acme-Tiny-0.4.tar.gz 
    
  3. Now use the tar command to extract the module:
    
    tar -xzf Acme-Tiny-0.4.tar.gz 
    
  4. Change into the directory:
    
    cd Acme-Tiny-0.4 
    
  5. 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 
    
  6. Run Make:
    make 
    
    
    cp 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 
    
  7. Run make install:
    make install 
    
    Installing /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 
    
  8. 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.
  9. 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";
  10. Give executable permissions to the test script and run it:
    
    chmod +x tinytest.pl
    ./tinytest.pl 
    0.4 
  11. 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. 

Resources

Was this article helpful?
0 out of 0 found this helpful

Comments