Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change
 
PerlMonks  

The perl source directory structure

by syphilis (Archbishop)
on Aug 16, 2022 at 12:21 UTC ( [id://11146162]=perlquestion: print w/replies, xml ) Need Help??

syphilis has asked for the wisdom of the Perl Monks concerning the following question:

Hi,

In the perl source, we find various modules in the 'cpan', 'dist' and 'ext' directories.
What are the rules that determine which of those 3 directories houses which modules ?

For example, why is it that POSIX is in the 'ext' directory, but threads is in the 'dist' directory ? (Why not the other way round ? Or why aren't they both in the same directory ?)

Cheers,
Rob

Replies are listed 'Best First'.
Re: The perl source directory structure
by afoken (Chancellor) on Aug 16, 2022 at 12:31 UTC

    Yes, it looks confusing. That's probably the legacy of a quarter century of development.

    Update:

    perlsource may have some clues:

    Core modules

    Modules shipped as part of the Perl core live in four subdirectories. Two of these directories contain modules that live in the core, and two contain modules that can also be released separately on CPAN. Modules which can be released on cpan are known as "dual-life" modules.

    lib/
    This directory contains pure-Perl modules which are only released as part of the core. This directory contains all of the modules and their tests, unlike other core modules.
    ext/
    Like lib/, this directory contains modules which are only released as part of the core. Unlike lib/, however, a module under ext/ generally has a CPAN-style directory- and file-layout and its own Makefile.PL. There is no expectation that a module under ext/ will work with earlier versions of Perl 5. Hence, such a module may take full advantage of syntactical and other improvements in Perl 5 blead.
    dist/
    This directory is for dual-life modules where the blead source is canonical. Note that some modules in this directory may not yet have been released separately on CPAN. Modules under dist/ should make an effort to work with earlier versions of Perl 5.
    cpan/
    This directory contains dual-life modules where the CPAN module is canonical. Do not patch these modules directly! Changes to these modules should be submitted to the maintainer of the CPAN module. Once those changes are applied and released, the new version of the module will be incorporated into the core.

    For some dual-life modules, it has not yet been determined if the CPAN version or the blead source is canonical. Until that is done, those modules should be in cpan/.

    Alexander

    --
    Today I will gladly share my knowledge and experience, for there are no sweeter words than "I told you so". ;-)

      The use of Makefile.PL in ext/[1] provides a well-established way to instruct how to build them. This is why modules with binary components are in ext/ and not lib/.


      1. This is what was called "CPAN-like", but isn't really because the directories here don't have any of the other files that CPAN wants.

      perlsource may have some clues

      Thanks afoken ... that's what I needed to read.

      I was being thrown by the fact that the dual-life module threads, located in the "dist" directory of the perl source, is currently at version 2.28 (2.27 in perl-5.36.0 source), yet CPAN stops at version 2.21 (from Jan 2018).
      But it turns out this is totally allowable under the perlsource spec for files located in the "dist" directory ... though I'm going to have a serious rethink about the meaning of "dual-life".
      If a "dual-life" module is going to remain at version 2.21 on CPAN forever more (either in order to remain backwards-compatible, or because no-one can be bothered updating the CPAN version), is it really "dual-life" ? What sort of a "dual" life is that ?
      To quote InfiniteSilence: "Might want to ask the Perl Porters that question" ;-)

      Cheers,
      Rob
Re: The perl source directory structure
by InfiniteSilence (Curate) on Aug 16, 2022 at 22:33 UTC
    Might want to ask the Perl Porters that question.

    Celebrate Intellectual Diversity

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://11146162]
Front-paged by LanX
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others examining the Monastery: (5)
As of 2024-04-25 10:01 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found