Managing Perl Libraries

From WormBaseWiki
Revision as of 21:33, 27 July 2009 by Tharris (talk | contribs) (New page: I use local::lib to maintain distinct sets of Perl module environments for multiple applications. It's great because you don't need to mess with multiple CPAN configurations or with tweak...)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigationJump to search

I use local::lib to maintain distinct sets of Perl module environments for multiple applications. It's great because you don't need to mess with multiple CPAN configurations or with tweaking your environment variables to recognize already installed local modules. local::lib handles it all for you.

local::lib Installation and Configuration

local::lib is installed into the system Perl path:

 sudo perl -MCPAN -e install 'local::lib'

Perl Module Locations

3rd party Perl modules are maintained in a common directory:

 /usr/local/wormbase/extlib

Within this directory are subdirectories for different versions or applications:

 classic/  - The "Classic" WormBase website
 2.0/  - The second iteration of the website

Setting your shell to install to the local environments

To set your current shell to use one of the local library do the following:

$ cd /usr/local/wormbase/extlib/2.0
$ perl -Mlocal::lib=./
$ eval $(perl -Mlocal::lib=--self-contained,./)
$ printenv     // Notice that the local path is now in your PERL5LIB

And install some modules:

$ perl -MCPAN -Mlocal::lib=--self-contained -e 'CPAN::install(MODULE)'

Required Perl modules

WormBase "Clasic"

Install the following Perl modules via CPAN. Note that you DO NOT AND SHOULD NOT be sudo.

cd /usr/local/wormbase/extlib/classic
perl -Mlocal::lib=./
eval $(perl -Mlocal::lib=--self-contained,./)
perl -MCPAN -e 'CPAN::install(MODULE)'
// Some basics...
YAML
LWP
ExtUtils::MakeMaker
Bundle::CPAN

// The rest...
Bio::Graphics
BioPerl   
     // When prompted, choose to download all optional modules. This will also install Ace:
Ace
     // During configuration, choose option (3), then set the remaining variables as follows:
   Site-specific configuration files:  /usr/local/wormbase/website-classic/conf
                                                       CGI path:  /usr/local/wormbase/website-classic/cgi-bin
                                                     HTML path:  /usr/local/wormbase/website-classic/html
                   Change these paths as appropriate for other projects.
Cache::Cache
Cache::FileCache
CGI
CGI::Session  
CGI::Cache
CGI::Toggle
Class::Base
Data::Stag
Date::Calc
Date::Manip
DB_File
DBI
DBD::mysql   (mysql devel package must be installed first)
    // To build by hand:
    perl Makefile.PL INSTALL_BASE=/usr/local/wormbase/extlib/classic --testuser=USER --testpassword=PASS
    make ; make test ; make install
Digest::MD5
Flickr::API
Flickr::API::Simple
    // This is a private library
    cd /usr/local/wormbase/build
    perl ./Build.PL --install_base /usr/local/wormbase/extlib/classic
   ./Build install
GD 
GD::SVG
GD::Graph
GD::Graph::pie
HTML::TokeParser
IO::Scalar
IO::String
Image::GD::Thumbnail
Log::Log4perl
MIME::Lite
Net::FTP
Proc::Simple
Search::Indexer
SOAP::Lite
Statistics::OLS
Storable
SVG
SVG::Graph
Term::ReadKey
Test::Pod
Text::Shellwords
Time::Format
WeakRef
XML::SAX
XML::Parser
XML::DOM
XML::Writer
XML::Twig
XML::Simple

Optional installation tips

BioPerl

Instead of building BioPerl from CPAN, it might be necessary to build from SVN:

 $ cd /usr/local/wormbase/build
 $ svn co svn+ssh://USERNAME@dev.open-bio.org/home/svn-repositories/bioperl/bioperl-live/trunk bioperl-live
 $ mv bioperl-live bioperl-live-tharris
 $ cd bioperl-live-tharris
 $ perl ./Build.PL install_base /usr/local/wormbase/extlib
 $ ./Build test
 $ ./Build install

Installing modules without using local::lib

You may on occasion need to install something without using local::lib. For EUMM modules, use

 perl -I/usr/local/wormbase/extlib/[PROJECT] Makefile.PL INSTALL_BASE=/usr/local/wormbase/extlib/[PROJECT]

And for Module::Build

 perl -I/usr/local/wormbase/extlib/[PROJECT] Makefile.PL --install_base /usr/local/wormbase/extlib/[PROJECT] 

Alternatively, you can manually edit ~/.cpan/CPAN/MyConfig.pm