Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

What is the difference between module and distribution on CPAN?

Tags:

perl

cpan

I was just comparing the numbers if different "Archive Networks", like CPAN, CTAN, rubygems.org etc. CPAN displays two very different numbers:

  • 105,774 modules
  • 24,657 distributions

As I'm not a Perl programmer (I'm just preparing a talk for university), I'm not familiar with Perl's wording. I tried to look them up and only found "module" to be defined by Perl itself. As far as I understood it, a module is any file with a namespace.

However, I can't find any declarations of what a distribution is. Even CPAN only shows a list of modules or they use both words together (as "module distribution"). Can anyone clear my mind?

like image 866
Florian Pilz Avatar asked Apr 16 '12 20:04

Florian Pilz


People also ask

What is a Perl distribution?

In Perl a true value is any value that is not: null, zero or a zero-length string. A distribution is a collection of files that usually includes a Perl module and several other files.

What is CPAN module in Perl?

The Comprehensive Perl Archive Network (CPAN) is a repository of over 250,000 software modules and accompanying documentation for 39,000 distributions, written in the Perl programming language by over 12,000 contributors.

How CPAN works?

CPAN, the Comprehensive Perl Archive Network is the system that makes these available for others to download and install. CPAN uses PAUSE's permissions data to determine if a given release contains unauthorized packages.

Where does CPAN install to?

CPAN doesn't actually install files. It runs the install script embedded in each distribution, which then performs the actual install. For distributions using ExtUtils::MakeMaker, the defaults are documented here: https://metacpan.org/pod/ExtUtils::MakeMaker#make-install (and the default value of INSTALLDIRS is site ).


1 Answers

A distribution will contain one or more modules, documentation, a build script, and also typically a test suite, a file manifest, readme, change log, and license information. Modules bundled together in a distribution are often part of complete class library, or at the very least all related tools divided into intuitively-named packages.

Taking, for example, the core IO distribution, you can see it contains the following modules:

  • IO - load various IO modules
  • IO::Dir - supply object methods for directory handles
  • IO::File - supply object methods for filehandles
  • IO::Handle - supply object methods for I/O handles
  • IO::Pipe - supply object methods for pipes
  • IO::Poll - Object interface to system poll call
  • IO::Seekable - supply seek based methods for I/O objects
  • IO::Select - OO interface to the select system call
  • IO::Socket - Object interface to socket communications
  • IO::Socket::INET - Object interface for AF_INET domain sockets
  • IO::Socket::UNIX - Object interface for AF_UNIX domain sockets
like image 56
Richard Simões Avatar answered Nov 15 '22 23:11

Richard Simões