Support / KnowledgeBase

 
Search the KnowledgeBase Search

Installing Perl modules on the (gs) Grid-Service

  • Applies to: (gs)

  • Difficulty: Medium

  • Time needed: 15 minutes

  • Tools needed: SSH,vi

 

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

  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. 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.

  11. Give executable permissions to the test script and run it:

    
    chmod +x tinytest.pl
    ./tinytest.pl 
    0.4 
  12. 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. 


Notes/Supplemental Resources:


Revisions:

2009-04-21: Article Creation


User Comments

No visitor comments posted. Post a comment

Fields marked with an asterisk(*) are required. Comment on this article

Fill out the form below if you would like to comment on this article.
 
 
 

(code is not case-sensitive)
 
Submit
 
 

Continue