NAME

CPAN::Site - CPAN.pm subclass for adding site local modules

INHERITANCE

CPAN::Site
  is a CPAN

SYNOPSIS

perl -MCPAN::Site -e shell
cpansite shell                # alternative

perl -MCPAN::Site -e 'install AnyModule'
cpansite install AnyModule    # alternative

DESCRIPTION

This module adds access to site specific modules to the CPAN.pm install interface; it adds a set of site-specific, non-public domain modules to the repository of the global CPAN.

The general idea is to have a local (pseudo) CPAN server which is asked first. If the request fails -which is the usual case, except for own modules-, CPAN.pm switches to the next URL in the list, which points to a server in the world-wide CPAN network.

DETAILS

QUICK SETUP EXAMPLE FOR IMPATIENT

This explanation was contributed by Alex Efros. There is also an extended explanation in the manual page of the cpansite script.

Let's say your (registered or un-registered) Pause-ID is IMPATIENT, :) and you have private module in file Private-Module-1.23.tar.gz. You wish to make it available from your own CPAN mirror (actually it's better to call it "overlay" instead) on website http://impatient.net/ located in directory /var/www/impatient.net/.

Configuring the server

# cpan CPAN::Site
# CPANSITE=/var/www/impatient.net/CPAN
# USERID=I/IM/IMPATIENT
# PUBLISH=$CPANSITE/authors/id/$USERID
# mkdir -p $PUBLISH
# cp Private-Module-1.23.tar.gz $PUBLISH
# cpansite -vl index $CPANSITE

This nested I/IM/IMPATIENT/ directory is CPAN's way of avoiding one huge directory with 5000 author names. Your mirror only requires one level, but it is cleaner to follow CPAN's practice.

You may also wish to add cpansite index to cron and have it run every hour or so. This way you can just copy new modules to $PUBLISH and they become automatically available on your CPAN mirror after a while. To do this you should run crontab -e and add single line like this:

CPANSITE=/var/www/impatient.net/CPAN
0 * * * *   cpansite -l index $CPANSITE &>/dev/null

Configuring the clients

# cpan CPAN::Site
# cpansite shell
cpan> o conf urllist unshift http://impatient.net/CPAN/
cpan> o conf commit

Now clients should cpansite command instead of cpan to search, install or update modules. The cpan command will use the real CPAN's indexes.

After doing above once, you can copy your ~/.cpan/CPAN/MyConfig.pm file to other systems where you wish to have the same configuration.

SEE ALSO

This module is part of CPAN-Site distribution version 1.00, built on September 01, 2009. Website: http://perl.overmeer.net/cpan-site/

LICENSE

Copyrights 1998,2005-2009 by Mark Overmeer. For other contributors see ChangeLog.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See http://www.perl.com/perl/misc/Artistic.html