CPAN

WebHome | UnixGeekTools | Geekfarm | About This Site

Pointers

Examples

    perl -MCPAN -e shell
    perl -MCPAN -e'install Date::Parse'

Setup

    perl -MCPAN -e'install Bundle::CPAN'

Shell Examples

    install Date::Parse
    clean Date::Parse

Find modules available for upgrade

from: http://www-128.ibm.com/developerworks/linux/library/l-depperl.html?ca=dgr-lnxw06AutoPerl

    # determine which perl modules are outdated
    perl -MCPAN -e 'CPAN::Shell->r'

    # install all outdated perl modules
    perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

    # generate list of installed modules
    # produces snapshot file, e.g. /export/build/solaris/cpan/Bundle/Snapshot_2004_08_08_00.pm
    perl -MCPAN -e autobundle

    # remove version numbers from autobundle to install latest version:
    perl -pi -e's|^([\w\:]+) [\d\.]+$|$1 undef|' /path/to/Snapshot_...

    # Install modules from generated autobundle
    perl -MCPAN -e 'install Bundle::Snapshot_2004_08_08_00'

Upgrading CPAN

    perl -MCPAN -e shell
    install CPAN
    reload CPAN
    install Bundle::CPAN

Custom perl lib path

    # http://sial.org/howto/perl/life-with-cpan/non-root/
    # build your own config
    cp ...perl5/5.8.8/CPAN/Config.pm ~/root/.cpan/CPAN/MyConfig.pm
    # make your edits to ~/root/.cpan/CPAN/MyConfig.pm, including adding:

    'makepl_arg' => q[PREFIX=~/root/ SITELIBEXP=~/root/lib/perl5 LIB=~/root/lib/perl5 INSTALLMAN1DIR=~/root/share/man/man1 INSTALLMAN3DIR=~/root/share/man/man3 INSTALLSITEMAN1DIR=~/root/share/man/man1 INSTALLSITEMAN3DIR=~/root/share/man/man3],

    # test syntax
    perl -c ~/root/.cpan/CPAN/MyConfig.pm

    # custom directory
    perl -I ~/root/.cpan -MCPAN -eshell

Determine modules that are currently installed

Pulling directly off the tap

I just uploaded my perl module and I want to install it immediately, i.e. before it gets copied out to the mirrors.

 o conf urllist unshift ftp://ftp.funet.fi/pub/languages/perl/CPAN/
 o conf cache_metadata 0
 install My::Module

/apps/cci/libperl5

PREFIX=/apps/cci SITELIBEXP=/apps/cci/libperl5 LIB=/apps/cci/libperl5 INSTALLMAN1DIR=/apps/cci/share/man/man1 INSTALLMAN3DIR=/apps/cci/share/man/man3 INSTALLSITEMAN1DIR=/apps/cci/share/man/man1 INSTALLSITEMAN3DIR=/apps/cci/share/man/man3

Misc

Search

CPANPLUS

CPAN++ (also referred to and pronounced as CPANPLUS) is a new and flexible method of perl module management and installation using the Comprehensive Perl Archive Network (CPAN). It aims to be a rewrite, and in time a replacement to the current CPAN.pm. In addition to fixing some long-standing problems, CPAN++ includes new features, such as module uninstall.

It has a modular build, which allows plug-ins. For example, with a plug-in to the RT bug tracking system, CPAN++ could be used to send an automatic bug report if a module failed to install.





Updated Tue May 8, 2007 5:09 PM