Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 29 Aug 1998 12:31:16 +0200
From:      Ollivier Robert <roberto@keltia.freenix.fr>
To:        committers@FreeBSD.org, ports@FreeBSD.org
Subject:   Re: p5-* ports
Message-ID:  <19980829123116.A29560@keltia.freenix.fr>
In-Reply-To: <199808282240.PAA27696@vader.cs.berkeley.edu>; from Satoshi Asami on Fri, Aug 28, 1998 at 03:40:49PM -0700
References:  <19980828212756.A26309@keltia.freenix.fr> <199808282240.PAA27696@vader.cs.berkeley.edu>

next in thread | previous in thread | raw e-mail | index | archive | help
According to Satoshi Asami:
> Can someone tell me how this works?

CPAN is a repository for all Perl modules / extentions / docs. There is a
list of all modules, updated regularely. When you start CPAN.pm[1], it will 
retrieve the modules file & the authors file and store them.

It can find which modules are outdated on your system and knows how to
translate "Foo::Bar" into "load CPAN/authors/id/BLAH/Foo-Bar-0.0.tar.gz".

You can compile, test and install within CPAN.pm (which has a rather nice
interface).

It won't automatically retrieve all the modules you need although they've
invented a new kind of module, the "bundle". As you imagine it is a virtual 
module which has all the ones you need (e.g. bundle-libnet).

One of the inconvenient is that it requires you to be connected when you
use it because you'll need to retrieve files from CPAN. You can run it
offline if you put the packages in the right place but it is cumbersome
IMO.

What would be possible is to more or less merge the ports system with
CPAN.pm by using direct routines inside CPAN.pm. There is an API for this:

...
       CPAN::Shell

       The commands that are available in the shell interface are
       methods in the package CPAN::Shell. If you enter the shell
       command, all your input is split by the
       Text::ParseWords::shellwords() routine which acts like
       most shells do. The first word is being interpreted as the
       method to be called and the rest of the words are treated
       as arguments to this method. Continuation lines are
       supported if a line ends with a literal backslash.
...
       Programming Examples
         This enables the programmer to do operations that
         combine functionalities that are available in the shell.

             # install everything that is outdated on my disk:
             perl -MCPAN -e 'CPAN::Shell->install(CPAN::Shell->r)'

             # install my favorite programs if necessary:
             for $mod (qw(Net::FTP MD5 Data::Dumper)){
                 my $obj = CPAN::Shell->expand('Module',$mod);
                 $obj->install;
             }

             # list all modules on my disk that have no VERSION number
             for $mod (CPAN::Shell->expand("Module","/./")){
                 next unless $mod->inst_file;
                 # MakeMaker convention for undefined $VERSION:
                 next unless $mod->inst_version eq "undef";
                 print "No VERSION in ", $mod->id, "\n";
             }
...
BUGS

       If a Makefile.PL requires special customization of
       libraries, prompts the user for special input, etc. then
       you may find CPAN is not able to build the distribution.
       In that case, you should attempt the traditional method of
       building a Perl module package from a shell.

-----
[1] "perl -MCPAN -e shell"

Interactive mode:

1259 [12:14] root@keltia:/etc/ssh2# perl -MCPAN -e shell

cpan shell -- CPAN exploration and modules installation (v1.3901)
ReadLine support enabled

cpan> h

command   arguments       description
a         string                  authors
b         or              display bundles
d         /regex/         info    distributions
m         or              about   modules
i         none                    anything of above

r          as             reinstall recommendations
u          above          uninstalled distributions
See manpage for autobundle, recompile, force, look, etc.

make                      make
test      modules,        make test (implies make)
install   dists, bundles, make install (implies test)
clean     "r" or "u"      make clean
readme                    display the README file

reload    index|cpan    load most recent indices/CPAN.pm
h or ?                  display this menu
o         various       set and query options
!         perl-code     eval a perl command
q                       quit the shell subroutine

-- 
Ollivier ROBERT -=- FreeBSD: The Power to Serve! -=- roberto@keltia.freenix.fr
FreeBSD keltia.freenix.fr 3.0-CURRENT #62: Mon Jul 27 20:47:08 CEST 1998




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?19980829123116.A29560>