in reply to CPAN: modules, distributions, and bundles

A distribution is generally a unit of installation. It may contain several modules, where perhaps only some are used at runtime by your code. Modules are generally units of functionality, and the author of a module distro may have decided that some set of functionality is so closely related (and maybe have so much common code) that it's worth distributing all in one piece.

A bundle (now also called Task) is a convenience "metadistribution" that triggers, via the dependency mechanism of CPAN/CPANPLUS, the installation of more that one distribution. This is typically used for optional but common functionality. For example, you can install the CPAN shell itself without any readline support, but commonly you'd like that and all the other goodies, so the one command "cpan Bundle::CPAN" will save you some pick-n-choosing.

Another example is the Pugs smoke tests. Those are completely optional—all you need to install Pugs is basically a reasonably recentish Perl 5—but if you do want to run the nice graphical smokes, Task::Smoke makes it easy to fetch and install anything you need, despite not containing any code of its own.

Replies are listed 'Best First'.
Re^2: CPAN: modules, distributions, and bundles
by j3 (Friar) on Nov 04, 2006 at 01:25 UTC
    A distribution is generally a unit of installation. It may contain several modules, where perhaps only some are used at runtime by your code.

    Is a single module distributed via CPAN generically referred to as a "distribution" per se? Or is that term specifically only applied to cases where a minimum of 2 or more modules are distributed bundled together?

    When you upload an archive to CPAN, are you offered a choice between uploading either a "module" or a "distribution"?

      Perl 5 the language doesn't strictly have the concept of a module: it has a "package", and even that bears only somewhat weak conventional overlap with a single file. A module on the other hand seems to be, by conventional usage, the unit of consumption by code. Since a distribution almost always also comes with additional files such as Makefile.PL, documentation, a changelog, metadata regarding prerequisites and licensing etc., and since CPAN attempts to make it easy to manage these units of software, you upload distributions, not modules, even if your distro has a single .pm file in it.

      (Incidentally, Perl 6 does have a "module" keyword, which encapsulates namespacing just like packages do, but adds versioning to the story. No doubt software will continue to have private namespaces not meant to be consumed by the user code directly, and perhaps the author of those would choose to use modules and not packages to contain them, but I'm betting programmers will continue to loosely talk about "installing that module" when in fact more than one may have been involved. (Then again, Perl 6 has lexically scoped namespaces, so if in the middle of my module I decide I need to implement a Parser, I can do "my package Parser {...}" and my stuff will not clash with any Parser namespace that was visible to you, where you had called me.))