| 1 |
.\" -*- mode: troff; coding: utf-8 -*- |
| 2 |
.\" Automatically generated by Pod::Man 5.0102 (Pod::Simple 3.45) |
| 3 |
.\" |
| 4 |
.\" Standard preamble: |
| 5 |
.\" ======================================================================== |
| 6 |
.de Sp \" Vertical space (when we can't use .PP) |
| 7 |
.if t .sp .5v |
| 8 |
.if n .sp |
| 9 |
.. |
| 10 |
.de Vb \" Begin verbatim text |
| 11 |
.ft CW |
| 12 |
.nf |
| 13 |
.ne \\$1 |
| 14 |
.. |
| 15 |
.de Ve \" End verbatim text |
| 16 |
.ft R |
| 17 |
.fi |
| 18 |
.. |
| 19 |
.\" \*(C` and \*(C' are quotes in nroff, nothing in troff, for use with C<>. |
| 20 |
.ie n \{\ |
| 21 |
. ds C` "" |
| 22 |
. ds C' "" |
| 23 |
'br\} |
| 24 |
.el\{\ |
| 25 |
. ds C` |
| 26 |
. ds C' |
| 27 |
'br\} |
| 28 |
.\" |
| 29 |
.\" Escape single quotes in literal strings from groff's Unicode transform. |
| 30 |
.ie \n(.g .ds Aq \(aq |
| 31 |
.el .ds Aq ' |
| 32 |
.\" |
| 33 |
.\" If the F register is >0, we'll generate index entries on stderr for |
| 34 |
.\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index |
| 35 |
.\" entries marked with X<> in POD. Of course, you'll have to process the |
| 36 |
.\" output yourself in some meaningful fashion. |
| 37 |
.\" |
| 38 |
.\" Avoid warning from groff about undefined register 'F'. |
| 39 |
.de IX |
| 40 |
.. |
| 41 |
.nr rF 0 |
| 42 |
.if \n(.g .if rF .nr rF 1 |
| 43 |
.if (\n(rF:(\n(.g==0)) \{\ |
| 44 |
. if \nF \{\ |
| 45 |
. de IX |
| 46 |
. tm Index:\\$1\t\\n%\t"\\$2" |
| 47 |
.. |
| 48 |
. if !\nF==2 \{\ |
| 49 |
. nr % 0 |
| 50 |
. nr F 2 |
| 51 |
. \} |
| 52 |
. \} |
| 53 |
.\} |
| 54 |
.rr rF |
| 55 |
.\" ======================================================================== |
| 56 |
.\" |
| 57 |
.IX Title "CPAN::Meta::Spec 3perl" |
| 58 |
.TH CPAN::Meta::Spec 3perl 2025-11-16 "perl v5.40.1" "Perl Programmers Reference Guide" |
| 59 |
.\" For nroff, turn off justification. Always turn off hyphenation; it makes |
| 60 |
.\" way too many mistakes in technical documents. |
| 61 |
.if n .ad l |
| 62 |
.nh |
| 63 |
.SH NAME |
| 64 |
CPAN::Meta::Spec \- specification for CPAN distribution metadata |
| 65 |
.SH VERSION |
| 66 |
.IX Header "VERSION" |
| 67 |
version 2.150010 |
| 68 |
.SH SYNOPSIS |
| 69 |
.IX Header "SYNOPSIS" |
| 70 |
.Vb 10 |
| 71 |
\& my $distmeta = { |
| 72 |
\& name => \*(AqModule\-Build\*(Aq, |
| 73 |
\& abstract => \*(AqBuild and install Perl modules\*(Aq, |
| 74 |
\& description => "Module::Build is a system for " |
| 75 |
\& . "building, testing, and installing Perl modules. " |
| 76 |
\& . "It is meant to ... blah blah blah ...", |
| 77 |
\& version => \*(Aq0.36\*(Aq, |
| 78 |
\& release_status => \*(Aqstable\*(Aq, |
| 79 |
\& author => [ |
| 80 |
\& \*(AqKen Williams <[email protected]>\*(Aq, |
| 81 |
\& \*(AqModule\-Build List <module\[email protected]>\*(Aq, # additional contact |
| 82 |
\& ], |
| 83 |
\& license => [ \*(Aqperl_5\*(Aq ], |
| 84 |
\& prereqs => { |
| 85 |
\& runtime => { |
| 86 |
\& requires => { |
| 87 |
\& \*(Aqperl\*(Aq => \*(Aq5.006\*(Aq, |
| 88 |
\& \*(AqExtUtils::Install\*(Aq => \*(Aq0\*(Aq, |
| 89 |
\& \*(AqFile::Basename\*(Aq => \*(Aq0\*(Aq, |
| 90 |
\& \*(AqFile::Compare\*(Aq => \*(Aq0\*(Aq, |
| 91 |
\& \*(AqIO::File\*(Aq => \*(Aq0\*(Aq, |
| 92 |
\& }, |
| 93 |
\& recommends => { |
| 94 |
\& \*(AqArchive::Tar\*(Aq => \*(Aq1.00\*(Aq, |
| 95 |
\& \*(AqExtUtils::Install\*(Aq => \*(Aq0.3\*(Aq, |
| 96 |
\& \*(AqExtUtils::ParseXS\*(Aq => \*(Aq2.02\*(Aq, |
| 97 |
\& }, |
| 98 |
\& }, |
| 99 |
\& build => { |
| 100 |
\& requires => { |
| 101 |
\& \*(AqTest::More\*(Aq => \*(Aq0\*(Aq, |
| 102 |
\& }, |
| 103 |
\& } |
| 104 |
\& }, |
| 105 |
\& resources => { |
| 106 |
\& license => [\*(Aqhttp://dev.perl.org/licenses/\*(Aq], |
| 107 |
\& }, |
| 108 |
\& optional_features => { |
| 109 |
\& domination => { |
| 110 |
\& description => \*(AqTake over the world\*(Aq, |
| 111 |
\& prereqs => { |
| 112 |
\& develop => { requires => { \*(AqGenius::Evil\*(Aq => \*(Aq1.234\*(Aq } }, |
| 113 |
\& runtime => { requires => { \*(AqMachine::Weather\*(Aq => \*(Aq2.0\*(Aq } }, |
| 114 |
\& }, |
| 115 |
\& }, |
| 116 |
\& }, |
| 117 |
\& dynamic_config => 1, |
| 118 |
\& keywords => [ qw/ toolchain cpan dual\-life / ], |
| 119 |
\& \*(Aqmeta\-spec\*(Aq => { |
| 120 |
\& version => \*(Aq2\*(Aq, |
| 121 |
\& url => \*(Aqhttps://metacpan.org/pod/CPAN::Meta::Spec\*(Aq, |
| 122 |
\& }, |
| 123 |
\& generated_by => \*(AqModule::Build version 0.36\*(Aq, |
| 124 |
\& }; |
| 125 |
.Ve |
| 126 |
.SH DESCRIPTION |
| 127 |
.IX Header "DESCRIPTION" |
| 128 |
This document describes version 2 of the CPAN distribution metadata |
| 129 |
specification, also known as the "CPAN Meta Spec". |
| 130 |
.PP |
| 131 |
Revisions of this specification for typo corrections and prose |
| 132 |
clarifications may be issued as CPAN::Meta::Spec 2.\fIx\fR. These |
| 133 |
revisions will never change semantics or add or remove specified |
| 134 |
behavior. |
| 135 |
.PP |
| 136 |
Distribution metadata describe important properties of Perl |
| 137 |
distributions. Distribution building tools like Module::Build, |
| 138 |
Module::Install, ExtUtils::MakeMaker or Dist::Zilla should create a |
| 139 |
metadata file in accordance with this specification and include it with |
| 140 |
the distribution for use by automated tools that index, examine, package |
| 141 |
or install Perl distributions. |
| 142 |
.SH TERMINOLOGY |
| 143 |
.IX Header "TERMINOLOGY" |
| 144 |
.IP distribution 4 |
| 145 |
.IX Item "distribution" |
| 146 |
This is the primary object described by the metadata. In the context of |
| 147 |
this document it usually refers to a collection of modules, scripts, |
| 148 |
and/or documents that are distributed together for other developers to |
| 149 |
use. Examples of distributions are \f(CW\*(C`Class\-Container\*(C'\fR, \f(CW\*(C`libwww\-perl\*(C'\fR, |
| 150 |
or \f(CW\*(C`DBI\*(C'\fR. |
| 151 |
.IP module 4 |
| 152 |
.IX Item "module" |
| 153 |
This refers to a reusable library of code contained in a single file. |
| 154 |
Modules usually contain one or more packages and are often referred |
| 155 |
to by the name of a primary package that can be mapped to the file |
| 156 |
name. For example, one might refer to \f(CW\*(C`File::Spec\*(C'\fR instead of |
| 157 |
\&\fIFile/Spec.pm\fR |
| 158 |
.IP package 4 |
| 159 |
.IX Item "package" |
| 160 |
This refers to a namespace declared with the Perl \f(CW\*(C`package\*(C'\fR statement. |
| 161 |
In Perl, packages often have a version number property given by the |
| 162 |
\&\f(CW$VERSION\fR variable in the namespace. |
| 163 |
.IP consumer 4 |
| 164 |
.IX Item "consumer" |
| 165 |
This refers to code that reads a metadata file, deserializes it into a |
| 166 |
data structure in memory, or interprets a data structure of metadata |
| 167 |
elements. |
| 168 |
.IP producer 4 |
| 169 |
.IX Item "producer" |
| 170 |
This refers to code that constructs a metadata data structure, |
| 171 |
serializes into a bytestream and/or writes it to disk. |
| 172 |
.IP "must, should, may, etc." 4 |
| 173 |
.IX Item "must, should, may, etc." |
| 174 |
These terms are interpreted as described in IETF RFC 2119. |
| 175 |
.SH "DATA TYPES" |
| 176 |
.IX Header "DATA TYPES" |
| 177 |
Fields in the "STRUCTURE" section describe data elements, each of |
| 178 |
which has an associated data type as described herein. There are four |
| 179 |
primitive types: Boolean, String, List and Map. Other types are |
| 180 |
subtypes of primitives and define compound data structures or define |
| 181 |
constraints on the values of a data element. |
| 182 |
.SS Boolean |
| 183 |
.IX Subsection "Boolean" |
| 184 |
A \fIBoolean\fR is used to provide a true or false value. It \fBmust\fR be |
| 185 |
represented as a defined value that is either "1" or "0" or stringifies |
| 186 |
to those values. |
| 187 |
.SS String |
| 188 |
.IX Subsection "String" |
| 189 |
A \fIString\fR is data element containing a non-zero length sequence of |
| 190 |
Unicode characters, such as an ordinary Perl scalar that is not a |
| 191 |
reference. |
| 192 |
.SS List |
| 193 |
.IX Subsection "List" |
| 194 |
A \fIList\fR is an ordered collection of zero or more data elements. |
| 195 |
Elements of a List may be of mixed types. |
| 196 |
.PP |
| 197 |
Producers \fBmust\fR represent List elements using a data structure which |
| 198 |
unambiguously indicates that multiple values are possible, such as a |
| 199 |
reference to a Perl array (an "arrayref"). |
| 200 |
.PP |
| 201 |
Consumers expecting a List \fBmust\fR consider a String as equivalent to a |
| 202 |
List of length 1. |
| 203 |
.SS Map |
| 204 |
.IX Subsection "Map" |
| 205 |
A \fIMap\fR is an unordered collection of zero or more data elements |
| 206 |
("values"), indexed by associated String elements ("keys"). The Map's |
| 207 |
value elements may be of mixed types. |
| 208 |
.SS "License String" |
| 209 |
.IX Subsection "License String" |
| 210 |
A \fILicense String\fR is a subtype of String with a restricted set of |
| 211 |
values. Valid values are described in detail in the description of |
| 212 |
the "license" field. |
| 213 |
.SS URL |
| 214 |
.IX Subsection "URL" |
| 215 |
\&\fIURL\fR is a subtype of String containing a Uniform Resource Locator or |
| 216 |
Identifier. [ This type is called URL and not URI for historical reasons. ] |
| 217 |
.SS Version |
| 218 |
.IX Subsection "Version" |
| 219 |
A \fIVersion\fR is a subtype of String containing a value that describes |
| 220 |
the version number of packages or distributions. Restrictions on format |
| 221 |
are described in detail in the "Version Formats" section. |
| 222 |
.SS "Version Range" |
| 223 |
.IX Subsection "Version Range" |
| 224 |
The \fIVersion Range\fR type is a subtype of String. It describes a range |
| 225 |
of Versions that may be present or installed to fulfill prerequisites. |
| 226 |
It is specified in detail in the "Version Ranges" section. |
| 227 |
.SH STRUCTURE |
| 228 |
.IX Header "STRUCTURE" |
| 229 |
The metadata structure is a data element of type Map. This section |
| 230 |
describes valid keys within the Map. |
| 231 |
.PP |
| 232 |
Any keys not described in this specification document (whether top-level |
| 233 |
or within compound data structures described herein) are considered |
| 234 |
\&\fIcustom keys\fR and \fBmust\fR begin with an "x" or "X" and be followed by an |
| 235 |
underscore; i.e. they must match the pattern: \f(CW\*(C`qr{\eAx_}i\*(C'\fR. If a |
| 236 |
custom key refers to a compound data structure, subkeys within it do not |
| 237 |
need an "x_" or "X_" prefix. |
| 238 |
.PP |
| 239 |
Consumers of metadata may ignore any or all custom keys. All other keys |
| 240 |
not described herein are invalid and should be ignored by consumers. |
| 241 |
Producers must not generate or output invalid keys. |
| 242 |
.PP |
| 243 |
For each key, an example is provided followed by a description. The |
| 244 |
description begins with the version of spec in which the key was added |
| 245 |
or in which the definition was modified, whether the key is \fIrequired\fR |
| 246 |
or \fIoptional\fR and the data type of the corresponding data element. |
| 247 |
These items are in parentheses, brackets and braces, respectively. |
| 248 |
.PP |
| 249 |
If a data type is a Map or Map subtype, valid subkeys will be described |
| 250 |
as well. |
| 251 |
.PP |
| 252 |
Some fields are marked \fIDeprecated\fR. These are shown for historical |
| 253 |
context and must not be produced in or consumed from any metadata structure |
| 254 |
of version 2 or higher. |
| 255 |
.SS "REQUIRED FIELDS" |
| 256 |
.IX Subsection "REQUIRED FIELDS" |
| 257 |
\fIabstract\fR |
| 258 |
.IX Subsection "abstract" |
| 259 |
.PP |
| 260 |
Example: |
| 261 |
.PP |
| 262 |
.Vb 1 |
| 263 |
\& abstract => \*(AqBuild and install Perl modules\*(Aq |
| 264 |
.Ve |
| 265 |
.PP |
| 266 |
(Spec 1.2) [required] {String} |
| 267 |
.PP |
| 268 |
This is a short description of the purpose of the distribution. |
| 269 |
.PP |
| 270 |
\fIauthor\fR |
| 271 |
.IX Subsection "author" |
| 272 |
.PP |
| 273 |
Example: |
| 274 |
.PP |
| 275 |
.Vb 1 |
| 276 |
\& author => [ \*(AqKen Williams <[email protected]>\*(Aq ] |
| 277 |
.Ve |
| 278 |
.PP |
| 279 |
(Spec 1.2) [required] {List of one or more Strings} |
| 280 |
.PP |
| 281 |
This List indicates the person(s) to contact concerning the |
| 282 |
distribution. The preferred form of the contact string is: |
| 283 |
.PP |
| 284 |
.Vb 1 |
| 285 |
\& contact\-name <email\-address> |
| 286 |
.Ve |
| 287 |
.PP |
| 288 |
This field provides a general contact list independent of other |
| 289 |
structured fields provided within the "resources" field, such as |
| 290 |
\&\f(CW\*(C`bugtracker\*(C'\fR. The addressee(s) can be contacted for any purpose |
| 291 |
including but not limited to (security) problems with the distribution, |
| 292 |
questions about the distribution or bugs in the distribution. |
| 293 |
.PP |
| 294 |
A distribution's original author is usually the contact listed within |
| 295 |
this field. Co-maintainers, successor maintainers or mailing lists |
| 296 |
devoted to the distribution may also be listed in addition to or instead |
| 297 |
of the original author. |
| 298 |
.PP |
| 299 |
\fIdynamic_config\fR |
| 300 |
.IX Subsection "dynamic_config" |
| 301 |
.PP |
| 302 |
Example: |
| 303 |
.PP |
| 304 |
.Vb 1 |
| 305 |
\& dynamic_config => 1 |
| 306 |
.Ve |
| 307 |
.PP |
| 308 |
(Spec 2) [required] {Boolean} |
| 309 |
.PP |
| 310 |
A boolean flag indicating whether a \fIBuild.PL\fR or \fIMakefile.PL\fR (or |
| 311 |
similar) must be executed to determine prerequisites. |
| 312 |
.PP |
| 313 |
This field should be set to a true value if the distribution performs |
| 314 |
some dynamic configuration (asking questions, sensing the environment, |
| 315 |
etc.) as part of its configuration. This field should be set to a false |
| 316 |
value to indicate that prerequisites included in metadata may be |
| 317 |
considered final and valid for static analysis. |
| 318 |
.PP |
| 319 |
Note: when this field is true, post-configuration prerequisites are not |
| 320 |
guaranteed to bear any relation whatsoever to those stated in the metadata, |
| 321 |
and relying on them doing so is an error. See also |
| 322 |
"Prerequisites for dynamically configured distributions" in the implementors' |
| 323 |
notes. |
| 324 |
.PP |
| 325 |
This field explicitly \fBdoes not\fR indicate whether installation may be |
| 326 |
safely performed without using a Makefile or Build file, as there may be |
| 327 |
special files to install or custom installation targets (e.g. for |
| 328 |
dual-life modules that exist on CPAN as well as in the Perl core). This |
| 329 |
field only defines whether or not prerequisites are exactly as given in the |
| 330 |
metadata. |
| 331 |
.PP |
| 332 |
\fIgenerated_by\fR |
| 333 |
.IX Subsection "generated_by" |
| 334 |
.PP |
| 335 |
Example: |
| 336 |
.PP |
| 337 |
.Vb 1 |
| 338 |
\& generated_by => \*(AqModule::Build version 0.36\*(Aq |
| 339 |
.Ve |
| 340 |
.PP |
| 341 |
(Spec 1.0) [required] {String} |
| 342 |
.PP |
| 343 |
This field indicates the tool that was used to create this metadata. |
| 344 |
There are no defined semantics for this field, but it is traditional to |
| 345 |
use a string in the form "Generating::Package version 1.23" or the |
| 346 |
author's name, if the file was generated by hand. |
| 347 |
.PP |
| 348 |
\fIlicense\fR |
| 349 |
.IX Subsection "license" |
| 350 |
.PP |
| 351 |
Example: |
| 352 |
.PP |
| 353 |
.Vb 1 |
| 354 |
\& license => [ \*(Aqperl_5\*(Aq ] |
| 355 |
\& |
| 356 |
\& license => [ \*(Aqapache_2_0\*(Aq, \*(Aqmozilla_1_0\*(Aq ] |
| 357 |
.Ve |
| 358 |
.PP |
| 359 |
(Spec 2) [required] {List of one or more License Strings} |
| 360 |
.PP |
| 361 |
One or more licenses that apply to some or all of the files in the |
| 362 |
distribution. If multiple licenses are listed, the distribution |
| 363 |
documentation should be consulted to clarify the interpretation of |
| 364 |
multiple licenses. |
| 365 |
.PP |
| 366 |
The following list of license strings are valid: |
| 367 |
.PP |
| 368 |
.Vb 10 |
| 369 |
\& string description |
| 370 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 371 |
\& agpl_3 GNU Affero General Public License, Version 3 |
| 372 |
\& apache_1_1 Apache Software License, Version 1.1 |
| 373 |
\& apache_2_0 Apache License, Version 2.0 |
| 374 |
\& artistic_1 Artistic License, (Version 1) |
| 375 |
\& artistic_2 Artistic License, Version 2.0 |
| 376 |
\& bsd BSD License (three\-clause) |
| 377 |
\& freebsd FreeBSD License (two\-clause) |
| 378 |
\& gfdl_1_2 GNU Free Documentation License, Version 1.2 |
| 379 |
\& gfdl_1_3 GNU Free Documentation License, Version 1.3 |
| 380 |
\& gpl_1 GNU General Public License, Version 1 |
| 381 |
\& gpl_2 GNU General Public License, Version 2 |
| 382 |
\& gpl_3 GNU General Public License, Version 3 |
| 383 |
\& lgpl_2_1 GNU Lesser General Public License, Version 2.1 |
| 384 |
\& lgpl_3_0 GNU Lesser General Public License, Version 3.0 |
| 385 |
\& mit MIT (aka X11) License |
| 386 |
\& mozilla_1_0 Mozilla Public License, Version 1.0 |
| 387 |
\& mozilla_1_1 Mozilla Public License, Version 1.1 |
| 388 |
\& openssl OpenSSL License |
| 389 |
\& perl_5 The Perl 5 License (Artistic 1 & GPL 1 or later) |
| 390 |
\& qpl_1_0 Q Public License, Version 1.0 |
| 391 |
\& ssleay Original SSLeay License |
| 392 |
\& sun Sun Internet Standards Source License (SISSL) |
| 393 |
\& zlib zlib License |
| 394 |
.Ve |
| 395 |
.PP |
| 396 |
The following license strings are also valid and indicate other |
| 397 |
licensing not described above: |
| 398 |
.PP |
| 399 |
.Vb 6 |
| 400 |
\& string description |
| 401 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 402 |
\& open_source Other Open Source Initiative (OSI) approved license |
| 403 |
\& restricted Requires special permission from copyright holder |
| 404 |
\& unrestricted Not an OSI approved license, but not restricted |
| 405 |
\& unknown License not provided in metadata |
| 406 |
.Ve |
| 407 |
.PP |
| 408 |
All other strings are invalid in the license field. |
| 409 |
.PP |
| 410 |
\fImeta-spec\fR |
| 411 |
.IX Subsection "meta-spec" |
| 412 |
.PP |
| 413 |
Example: |
| 414 |
.PP |
| 415 |
.Vb 4 |
| 416 |
\& \*(Aqmeta\-spec\*(Aq => { |
| 417 |
\& version => \*(Aq2\*(Aq, |
| 418 |
\& url => \*(Aqhttp://search.cpan.org/perldoc?CPAN::Meta::Spec\*(Aq, |
| 419 |
\& } |
| 420 |
.Ve |
| 421 |
.PP |
| 422 |
(Spec 1.2) [required] {Map} |
| 423 |
.PP |
| 424 |
This field indicates the version of the CPAN Meta Spec that should be |
| 425 |
used to interpret the metadata. Consumers must check this key as soon |
| 426 |
as possible and abort further metadata processing if the meta-spec |
| 427 |
version is not supported by the consumer. |
| 428 |
.PP |
| 429 |
The following keys are valid, but only \f(CW\*(C`version\*(C'\fR is required. |
| 430 |
.IP version 4 |
| 431 |
.IX Item "version" |
| 432 |
This subkey gives the integer \fIVersion\fR of the CPAN Meta Spec against |
| 433 |
which the document was generated. |
| 434 |
.IP url 4 |
| 435 |
.IX Item "url" |
| 436 |
This is a \fIURL\fR of the metadata specification document corresponding to |
| 437 |
the given version. This is strictly for human-consumption and should |
| 438 |
not impact the interpretation of the document. |
| 439 |
.Sp |
| 440 |
For the version 2 spec, either of these are recommended: |
| 441 |
.RS 4 |
| 442 |
.IP \(bu 4 |
| 443 |
\&\f(CW\*(C`https://metacpan.org/pod/CPAN::Meta::Spec\*(C'\fR |
| 444 |
.IP \(bu 4 |
| 445 |
\&\f(CW\*(C`http://search.cpan.org/perldoc?CPAN::Meta::Spec\*(C'\fR |
| 446 |
.RE |
| 447 |
.RS 4 |
| 448 |
.RE |
| 449 |
.PP |
| 450 |
\fIname\fR |
| 451 |
.IX Subsection "name" |
| 452 |
.PP |
| 453 |
Example: |
| 454 |
.PP |
| 455 |
.Vb 1 |
| 456 |
\& name => \*(AqModule\-Build\*(Aq |
| 457 |
.Ve |
| 458 |
.PP |
| 459 |
(Spec 1.0) [required] {String} |
| 460 |
.PP |
| 461 |
This field is the name of the distribution. This is often created by |
| 462 |
taking the "main package" in the distribution and changing \f(CW\*(C`::\*(C'\fR to |
| 463 |
\&\f(CW\*(C`\-\*(C'\fR, but the name may be completely unrelated to the packages within |
| 464 |
the distribution. For example, LWP::UserAgent is distributed as part |
| 465 |
of the distribution name "libwww-perl". |
| 466 |
.PP |
| 467 |
\fIrelease_status\fR |
| 468 |
.IX Subsection "release_status" |
| 469 |
.PP |
| 470 |
Example: |
| 471 |
.PP |
| 472 |
.Vb 1 |
| 473 |
\& release_status => \*(Aqstable\*(Aq |
| 474 |
.Ve |
| 475 |
.PP |
| 476 |
(Spec 2) [required] {String} |
| 477 |
.PP |
| 478 |
This field provides the release status of this distribution. If the |
| 479 |
\&\f(CW\*(C`version\*(C'\fR field contains an underscore character, then |
| 480 |
\&\f(CW\*(C`release_status\*(C'\fR \fBmust not\fR be "stable." |
| 481 |
.PP |
| 482 |
The \f(CW\*(C`release_status\*(C'\fR field \fBmust\fR have one of the following values: |
| 483 |
.IP stable 4 |
| 484 |
.IX Item "stable" |
| 485 |
This indicates an ordinary, "final" release that should be indexed by PAUSE |
| 486 |
or other indexers. |
| 487 |
.IP testing 4 |
| 488 |
.IX Item "testing" |
| 489 |
This indicates a "beta" release that is substantially complete, but has an |
| 490 |
elevated risk of bugs and requires additional testing. The distribution |
| 491 |
should not be installed over a stable release without an explicit request |
| 492 |
or other confirmation from a user. This release status may also be used |
| 493 |
for "release candidate" versions of a distribution. |
| 494 |
.IP unstable 4 |
| 495 |
.IX Item "unstable" |
| 496 |
This indicates an "alpha" release that is under active development, but has |
| 497 |
been released for early feedback or testing and may be missing features or |
| 498 |
may have serious bugs. The distribution should not be installed over a |
| 499 |
stable release without an explicit request or other confirmation from a |
| 500 |
user. |
| 501 |
.PP |
| 502 |
Consumers \fBmay\fR use this field to determine how to index the |
| 503 |
distribution for CPAN or other repositories in addition to or in |
| 504 |
replacement of heuristics based on version number or file name. |
| 505 |
.PP |
| 506 |
\fIversion\fR |
| 507 |
.IX Subsection "version" |
| 508 |
.PP |
| 509 |
Example: |
| 510 |
.PP |
| 511 |
.Vb 1 |
| 512 |
\& version => \*(Aq0.36\*(Aq |
| 513 |
.Ve |
| 514 |
.PP |
| 515 |
(Spec 1.0) [required] {Version} |
| 516 |
.PP |
| 517 |
This field gives the version of the distribution to which the metadata |
| 518 |
structure refers. |
| 519 |
.SS "OPTIONAL FIELDS" |
| 520 |
.IX Subsection "OPTIONAL FIELDS" |
| 521 |
\fIdescription\fR |
| 522 |
.IX Subsection "description" |
| 523 |
.PP |
| 524 |
Example: |
| 525 |
.PP |
| 526 |
.Vb 3 |
| 527 |
\& description => "Module::Build is a system for " |
| 528 |
\& . "building, testing, and installing Perl modules. " |
| 529 |
\& . "It is meant to ... blah blah blah ...", |
| 530 |
.Ve |
| 531 |
.PP |
| 532 |
(Spec 2) [optional] {String} |
| 533 |
.PP |
| 534 |
A longer, more complete description of the purpose or intended use of |
| 535 |
the distribution than the one provided by the \f(CW\*(C`abstract\*(C'\fR key. |
| 536 |
.PP |
| 537 |
\fIkeywords\fR |
| 538 |
.IX Subsection "keywords" |
| 539 |
.PP |
| 540 |
Example: |
| 541 |
.PP |
| 542 |
.Vb 1 |
| 543 |
\& keywords => [ qw/ toolchain cpan dual\-life / ] |
| 544 |
.Ve |
| 545 |
.PP |
| 546 |
(Spec 1.1) [optional] {List of zero or more Strings} |
| 547 |
.PP |
| 548 |
A List of keywords that describe this distribution. Keywords |
| 549 |
\&\fBmust not\fR include whitespace. |
| 550 |
.PP |
| 551 |
\fIno_index\fR |
| 552 |
.IX Subsection "no_index" |
| 553 |
.PP |
| 554 |
Example: |
| 555 |
.PP |
| 556 |
.Vb 6 |
| 557 |
\& no_index => { |
| 558 |
\& file => [ \*(AqMy/Module.pm\*(Aq ], |
| 559 |
\& directory => [ \*(AqMy/Private\*(Aq ], |
| 560 |
\& package => [ \*(AqMy::Module::Secret\*(Aq ], |
| 561 |
\& namespace => [ \*(AqMy::Module::Sample\*(Aq ], |
| 562 |
\& } |
| 563 |
.Ve |
| 564 |
.PP |
| 565 |
(Spec 1.2) [optional] {Map} |
| 566 |
.PP |
| 567 |
This Map describes any files, directories, packages, and namespaces that |
| 568 |
are private to the packaging or implementation of the distribution and |
| 569 |
should be ignored by indexing or search tools. Note that this is a list of |
| 570 |
exclusions, and the spec does not define what to \fIinclude\fR \- see |
| 571 |
"Indexing distributions a la PAUSE" in the implementors notes for more |
| 572 |
information. |
| 573 |
.PP |
| 574 |
Valid subkeys are as follows: |
| 575 |
.IP file 4 |
| 576 |
.IX Item "file" |
| 577 |
A \fIList\fR of relative paths to files. Paths \fBmust be\fR specified with |
| 578 |
unix conventions. |
| 579 |
.IP directory 4 |
| 580 |
.IX Item "directory" |
| 581 |
A \fIList\fR of relative paths to directories. Paths \fBmust be\fR specified |
| 582 |
with unix conventions. |
| 583 |
.Sp |
| 584 |
[ Note: previous editions of the spec had \f(CW\*(C`dir\*(C'\fR instead of \f(CW\*(C`directory\*(C'\fR ] |
| 585 |
.IP package 4 |
| 586 |
.IX Item "package" |
| 587 |
A \fIList\fR of package names. |
| 588 |
.IP namespace 4 |
| 589 |
.IX Item "namespace" |
| 590 |
A \fIList\fR of package namespaces, where anything below the namespace |
| 591 |
must be ignored, but \fInot\fR the namespace itself. |
| 592 |
.Sp |
| 593 |
In the example above for \f(CW\*(C`no_index\*(C'\fR, \f(CW\*(C`My::Module::Sample::Foo\*(C'\fR would |
| 594 |
be ignored, but \f(CW\*(C`My::Module::Sample\*(C'\fR would not. |
| 595 |
.PP |
| 596 |
\fIoptional_features\fR |
| 597 |
.IX Subsection "optional_features" |
| 598 |
.PP |
| 599 |
Example: |
| 600 |
.PP |
| 601 |
.Vb 12 |
| 602 |
\& optional_features => { |
| 603 |
\& sqlite => { |
| 604 |
\& description => \*(AqProvides SQLite support\*(Aq, |
| 605 |
\& prereqs => { |
| 606 |
\& runtime => { |
| 607 |
\& requires => { |
| 608 |
\& \*(AqDBD::SQLite\*(Aq => \*(Aq1.25\*(Aq |
| 609 |
\& } |
| 610 |
\& } |
| 611 |
\& } |
| 612 |
\& } |
| 613 |
\& } |
| 614 |
.Ve |
| 615 |
.PP |
| 616 |
(Spec 2) [optional] {Map} |
| 617 |
.PP |
| 618 |
This Map describes optional features with incremental prerequisites. |
| 619 |
Each key of the \f(CW\*(C`optional_features\*(C'\fR Map is a String used to identify |
| 620 |
the feature and each value is a Map with additional information about |
| 621 |
the feature. Valid subkeys include: |
| 622 |
.IP description 4 |
| 623 |
.IX Item "description" |
| 624 |
This is a String describing the feature. Every optional feature |
| 625 |
should provide a description |
| 626 |
.IP prereqs 4 |
| 627 |
.IX Item "prereqs" |
| 628 |
This entry is required and has the same structure as that of the |
| 629 |
\&\f(CW"prereqs"\fR key. It provides a list of package requirements |
| 630 |
that must be satisfied for the feature to be supported or enabled. |
| 631 |
.Sp |
| 632 |
There is one crucial restriction: the prereqs of an optional feature |
| 633 |
\&\fBmust not\fR include \f(CW\*(C`configure\*(C'\fR phase prereqs. |
| 634 |
.PP |
| 635 |
Consumers \fBmust not\fR include optional features as prerequisites without |
| 636 |
explicit instruction from users (whether via interactive prompting, |
| 637 |
a function parameter or a configuration value, etc. ). |
| 638 |
.PP |
| 639 |
If an optional feature is used by a consumer to add additional |
| 640 |
prerequisites, the consumer should merge the optional feature |
| 641 |
prerequisites into those given by the \f(CW\*(C`prereqs\*(C'\fR key using the same |
| 642 |
semantics. See "Merging and Resolving Prerequisites" for details on |
| 643 |
merging prerequisites. |
| 644 |
.PP |
| 645 |
\&\fISuggestion for disuse:\fR Because there is currently no way for a |
| 646 |
distribution to specify a dependency on an optional feature of another |
| 647 |
dependency, the use of \f(CW\*(C`optional_feature\*(C'\fR is discouraged. Instead, |
| 648 |
create a separate, installable distribution that ensures the desired |
| 649 |
feature is available. For example, if \f(CW\*(C`Foo::Bar\*(C'\fR has a \f(CW\*(C`Baz\*(C'\fR feature, |
| 650 |
release a separate \f(CW\*(C`Foo\-Bar\-Baz\*(C'\fR distribution that satisfies |
| 651 |
requirements for the feature. |
| 652 |
.PP |
| 653 |
\fIprereqs\fR |
| 654 |
.IX Subsection "prereqs" |
| 655 |
.PP |
| 656 |
Example: |
| 657 |
.PP |
| 658 |
.Vb 10 |
| 659 |
\& prereqs => { |
| 660 |
\& runtime => { |
| 661 |
\& requires => { |
| 662 |
\& \*(Aqperl\*(Aq => \*(Aq5.006\*(Aq, |
| 663 |
\& \*(AqFile::Spec\*(Aq => \*(Aq0.86\*(Aq, |
| 664 |
\& \*(AqJSON\*(Aq => \*(Aq2.16\*(Aq, |
| 665 |
\& }, |
| 666 |
\& recommends => { |
| 667 |
\& \*(AqJSON::XS\*(Aq => \*(Aq2.26\*(Aq, |
| 668 |
\& }, |
| 669 |
\& suggests => { |
| 670 |
\& \*(AqArchive::Tar\*(Aq => \*(Aq0\*(Aq, |
| 671 |
\& }, |
| 672 |
\& }, |
| 673 |
\& build => { |
| 674 |
\& requires => { |
| 675 |
\& \*(AqAlien::SDL\*(Aq => \*(Aq1.00\*(Aq, |
| 676 |
\& }, |
| 677 |
\& }, |
| 678 |
\& test => { |
| 679 |
\& recommends => { |
| 680 |
\& \*(AqTest::Deep\*(Aq => \*(Aq0.10\*(Aq, |
| 681 |
\& }, |
| 682 |
\& } |
| 683 |
\& } |
| 684 |
.Ve |
| 685 |
.PP |
| 686 |
(Spec 2) [optional] {Map} |
| 687 |
.PP |
| 688 |
This is a Map that describes all the prerequisites of the distribution. |
| 689 |
The keys are phases of activity, such as \f(CW\*(C`configure\*(C'\fR, \f(CW\*(C`build\*(C'\fR, \f(CW\*(C`test\*(C'\fR |
| 690 |
or \f(CW\*(C`runtime\*(C'\fR. Values are Maps in which the keys name the type of |
| 691 |
prerequisite relationship such as \f(CW\*(C`requires\*(C'\fR, \f(CW\*(C`recommends\*(C'\fR, or |
| 692 |
\&\f(CW\*(C`suggests\*(C'\fR and the value provides a set of prerequisite relations. The |
| 693 |
set of relations \fBmust\fR be specified as a Map of package names to |
| 694 |
version ranges. |
| 695 |
.PP |
| 696 |
The full definition for this field is given in the "Prereq Spec" |
| 697 |
section. |
| 698 |
.PP |
| 699 |
\fIprovides\fR |
| 700 |
.IX Subsection "provides" |
| 701 |
.PP |
| 702 |
Example: |
| 703 |
.PP |
| 704 |
.Vb 10 |
| 705 |
\& provides => { |
| 706 |
\& \*(AqFoo::Bar\*(Aq => { |
| 707 |
\& file => \*(Aqlib/Foo/Bar.pm\*(Aq, |
| 708 |
\& version => \*(Aq0.27_02\*(Aq, |
| 709 |
\& }, |
| 710 |
\& \*(AqFoo::Bar::Blah\*(Aq => { |
| 711 |
\& file => \*(Aqlib/Foo/Bar/Blah.pm\*(Aq, |
| 712 |
\& }, |
| 713 |
\& \*(AqFoo::Bar::Baz\*(Aq => { |
| 714 |
\& file => \*(Aqlib/Foo/Bar/Baz.pm\*(Aq, |
| 715 |
\& version => \*(Aq0.3\*(Aq, |
| 716 |
\& }, |
| 717 |
\& } |
| 718 |
.Ve |
| 719 |
.PP |
| 720 |
(Spec 1.2) [optional] {Map} |
| 721 |
.PP |
| 722 |
This describes all packages provided by this distribution. This |
| 723 |
information is used by distribution and automation mechanisms like |
| 724 |
PAUSE, CPAN, metacpan.org and search.cpan.org to build indexes saying in |
| 725 |
which distribution various packages can be found. |
| 726 |
.PP |
| 727 |
The keys of \f(CW\*(C`provides\*(C'\fR are package names that can be found within |
| 728 |
the distribution. If a package name key is provided, it must |
| 729 |
have a Map with the following valid subkeys: |
| 730 |
.IP file 4 |
| 731 |
.IX Item "file" |
| 732 |
This field is required. It must contain a Unix-style relative file path |
| 733 |
from the root of the distribution directory to a file that contains or |
| 734 |
generates the package. It may be given as \f(CW\*(C`META.yml\*(C'\fR or \f(CW\*(C`META.json\*(C'\fR |
| 735 |
to claim a package for indexing without needing a \f(CW\*(C`*.pm\*(C'\fR. |
| 736 |
.IP version 4 |
| 737 |
.IX Item "version" |
| 738 |
If it exists, this field must contains a \fIVersion\fR String for the |
| 739 |
package. If the package does not have a \f(CW$VERSION\fR, this field must |
| 740 |
be omitted. |
| 741 |
.PP |
| 742 |
\fIresources\fR |
| 743 |
.IX Subsection "resources" |
| 744 |
.PP |
| 745 |
Example: |
| 746 |
.PP |
| 747 |
.Vb 10 |
| 748 |
\& resources => { |
| 749 |
\& license => [ \*(Aqhttp://dev.perl.org/licenses/\*(Aq ], |
| 750 |
\& homepage => \*(Aqhttp://sourceforge.net/projects/module\-build\*(Aq, |
| 751 |
\& bugtracker => { |
| 752 |
\& web => \*(Aqhttp://rt.cpan.org/Public/Dist/Display.html?Name=CPAN\-Meta\*(Aq, |
| 753 |
\& mailto => \*(Aqmeta\[email protected]\*(Aq, |
| 754 |
\& }, |
| 755 |
\& repository => { |
| 756 |
\& url => \*(Aqgit://github.com/dagolden/cpan\-meta.git\*(Aq, |
| 757 |
\& web => \*(Aqhttp://github.com/dagolden/cpan\-meta\*(Aq, |
| 758 |
\& type => \*(Aqgit\*(Aq, |
| 759 |
\& }, |
| 760 |
\& x_twitter => \*(Aqhttp://twitter.com/cpan_linked/\*(Aq, |
| 761 |
\& } |
| 762 |
.Ve |
| 763 |
.PP |
| 764 |
(Spec 2) [optional] {Map} |
| 765 |
.PP |
| 766 |
This field describes resources related to this distribution. |
| 767 |
.PP |
| 768 |
Valid subkeys include: |
| 769 |
.IP homepage 4 |
| 770 |
.IX Item "homepage" |
| 771 |
The official home of this project on the web. |
| 772 |
.IP license 4 |
| 773 |
.IX Item "license" |
| 774 |
A List of \fIURL\fR's that relate to this distribution's license. As with the |
| 775 |
top-level \f(CW\*(C`license\*(C'\fR field, distribution documentation should be consulted |
| 776 |
to clarify the interpretation of multiple licenses provided here. |
| 777 |
.IP bugtracker 4 |
| 778 |
.IX Item "bugtracker" |
| 779 |
This entry describes the bug tracking system for this distribution. It |
| 780 |
is a Map with the following valid keys: |
| 781 |
.Sp |
| 782 |
.Vb 2 |
| 783 |
\& web \- a URL pointing to a web front\-end for the bug tracker |
| 784 |
\& mailto \- an email address to which bugs can be sent |
| 785 |
.Ve |
| 786 |
.IP repository 4 |
| 787 |
.IX Item "repository" |
| 788 |
This entry describes the source control repository for this distribution. It |
| 789 |
is a Map with the following valid keys: |
| 790 |
.Sp |
| 791 |
.Vb 3 |
| 792 |
\& url \- a URL pointing to the repository itself |
| 793 |
\& web \- a URL pointing to a web front\-end for the repository |
| 794 |
\& type \- a lowercase string indicating the VCS used |
| 795 |
.Ve |
| 796 |
.Sp |
| 797 |
Because a url like \f(CW\*(C`http://myrepo.example.com/\*(C'\fR is ambiguous as to |
| 798 |
type, producers should provide a \f(CW\*(C`type\*(C'\fR whenever a \f(CW\*(C`url\*(C'\fR key is given. |
| 799 |
The \f(CW\*(C`type\*(C'\fR field should be the name of the most common program used |
| 800 |
to work with the repository, e.g. \f(CW\*(C`git\*(C'\fR, \f(CW\*(C`svn\*(C'\fR, \f(CW\*(C`cvs\*(C'\fR, \f(CW\*(C`darcs\*(C'\fR, |
| 801 |
\&\f(CW\*(C`bzr\*(C'\fR or \f(CW\*(C`hg\*(C'\fR. |
| 802 |
.SS "DEPRECATED FIELDS" |
| 803 |
.IX Subsection "DEPRECATED FIELDS" |
| 804 |
\fIbuild_requires\fR |
| 805 |
.IX Subsection "build_requires" |
| 806 |
.PP |
| 807 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 808 |
.PP |
| 809 |
Replaced by \f(CW\*(C`prereqs\*(C'\fR |
| 810 |
.PP |
| 811 |
\fIconfigure_requires\fR |
| 812 |
.IX Subsection "configure_requires" |
| 813 |
.PP |
| 814 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 815 |
.PP |
| 816 |
Replaced by \f(CW\*(C`prereqs\*(C'\fR |
| 817 |
.PP |
| 818 |
\fIconflicts\fR |
| 819 |
.IX Subsection "conflicts" |
| 820 |
.PP |
| 821 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 822 |
.PP |
| 823 |
Replaced by \f(CW\*(C`prereqs\*(C'\fR |
| 824 |
.PP |
| 825 |
\fIdistribution_type\fR |
| 826 |
.IX Subsection "distribution_type" |
| 827 |
.PP |
| 828 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 829 |
.PP |
| 830 |
This field indicated 'module' or 'script' but was considered |
| 831 |
meaningless, since many distributions are hybrids of several kinds of |
| 832 |
things. |
| 833 |
.PP |
| 834 |
\fIlicense_uri\fR |
| 835 |
.IX Subsection "license_uri" |
| 836 |
.PP |
| 837 |
\&\fI(Deprecated in Spec 1.2)\fR [optional] {URL} |
| 838 |
.PP |
| 839 |
Replaced by \f(CW\*(C`license\*(C'\fR in \f(CW\*(C`resources\*(C'\fR |
| 840 |
.PP |
| 841 |
\fIprivate\fR |
| 842 |
.IX Subsection "private" |
| 843 |
.PP |
| 844 |
\&\fI(Deprecated in Spec 1.2)\fR [optional] {Map} |
| 845 |
.PP |
| 846 |
This field has been renamed to "no_index". |
| 847 |
.PP |
| 848 |
\fIrecommends\fR |
| 849 |
.IX Subsection "recommends" |
| 850 |
.PP |
| 851 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 852 |
.PP |
| 853 |
Replaced by \f(CW\*(C`prereqs\*(C'\fR |
| 854 |
.PP |
| 855 |
\fIrequires\fR |
| 856 |
.IX Subsection "requires" |
| 857 |
.PP |
| 858 |
\&\fI(Deprecated in Spec 2)\fR [optional] {String} |
| 859 |
.PP |
| 860 |
Replaced by \f(CW\*(C`prereqs\*(C'\fR |
| 861 |
.SH "VERSION NUMBERS" |
| 862 |
.IX Header "VERSION NUMBERS" |
| 863 |
.SS "Version Formats" |
| 864 |
.IX Subsection "Version Formats" |
| 865 |
This section defines the Version type, used by several fields in the |
| 866 |
CPAN Meta Spec. |
| 867 |
.PP |
| 868 |
Version numbers must be treated as strings, not numbers. For |
| 869 |
example, \f(CW1.200\fR \fBmust not\fR be serialized as \f(CW1.2\fR. Version |
| 870 |
comparison should be delegated to the Perl version module, version |
| 871 |
0.80 or newer. |
| 872 |
.PP |
| 873 |
Unless otherwise specified, version numbers \fBmust\fR appear in one of two |
| 874 |
formats: |
| 875 |
.IP "Decimal versions" 4 |
| 876 |
.IX Item "Decimal versions" |
| 877 |
Decimal versions are regular "decimal numbers", with some limitations. |
| 878 |
They \fBmust\fR be non-negative and \fBmust\fR begin and end with a digit. A |
| 879 |
single underscore \fBmay\fR be included, but \fBmust\fR be between two digits. |
| 880 |
They \fBmust not\fR use exponential notation ("1.23e\-2"). |
| 881 |
.Sp |
| 882 |
.Vb 2 |
| 883 |
\& version => \*(Aq1.234\*(Aq # OK |
| 884 |
\& version => \*(Aq1.23_04\*(Aq # OK |
| 885 |
\& |
| 886 |
\& version => \*(Aq1.23_04_05\*(Aq # Illegal |
| 887 |
\& version => \*(Aq1.\*(Aq # Illegal |
| 888 |
\& version => \*(Aq.1\*(Aq # Illegal |
| 889 |
.Ve |
| 890 |
.IP "Dotted-integer versions" 4 |
| 891 |
.IX Item "Dotted-integer versions" |
| 892 |
Dotted-integer (also known as dotted-decimal) versions consist of |
| 893 |
positive integers separated by full stop characters (i.e. "dots", |
| 894 |
"periods" or "decimal points"). This are equivalent in format to Perl |
| 895 |
"v\-strings", with some additional restrictions on form. They must be |
| 896 |
given in "normal" form, which has a leading "v" character and at least |
| 897 |
three integer components. To retain a one-to-one mapping with decimal |
| 898 |
versions, all components after the first \fBshould\fR be restricted to the |
| 899 |
range 0 to 999. The final component \fBmay\fR be separated by an |
| 900 |
underscore character instead of a period. |
| 901 |
.Sp |
| 902 |
.Vb 5 |
| 903 |
\& version => \*(Aqv1.2.3\*(Aq # OK |
| 904 |
\& version => \*(Aqv1.2_3\*(Aq # OK |
| 905 |
\& version => \*(Aqv1.2.3.4\*(Aq # OK |
| 906 |
\& version => \*(Aqv1.2.3_4\*(Aq # OK |
| 907 |
\& version => \*(Aqv2009.10.31\*(Aq # OK |
| 908 |
\& |
| 909 |
\& version => \*(Aqv1.2\*(Aq # Illegal |
| 910 |
\& version => \*(Aq1.2.3\*(Aq # Illegal |
| 911 |
\& version => \*(Aqv1.2_3_4\*(Aq # Illegal |
| 912 |
\& version => \*(Aqv1.2009.10.31\*(Aq # Not recommended |
| 913 |
.Ve |
| 914 |
.SS "Version Ranges" |
| 915 |
.IX Subsection "Version Ranges" |
| 916 |
Some fields (prereq, optional_features) indicate the particular |
| 917 |
version(s) of some other module that may be required as a prerequisite. |
| 918 |
This section details the Version Range type used to provide this |
| 919 |
information. |
| 920 |
.PP |
| 921 |
The simplest format for a Version Range is just the version |
| 922 |
number itself, e.g. \f(CW2.4\fR. This means that \fBat least\fR version 2.4 |
| 923 |
must be present. To indicate that \fBany\fR version of a prerequisite is |
| 924 |
okay, even if the prerequisite doesn't define a version at all, use |
| 925 |
the version \f(CW0\fR. |
| 926 |
.PP |
| 927 |
Alternatively, a version range \fBmay\fR use the operators < (less than), |
| 928 |
<= (less than or equal), > (greater than), >= (greater than |
| 929 |
or equal), == (equal), and != (not equal). For example, the |
| 930 |
specification \f(CW\*(C`< 2.0\*(C'\fR means that any version of the prerequisite |
| 931 |
less than 2.0 is suitable. |
| 932 |
.PP |
| 933 |
For more complicated situations, version specifications \fBmay\fR be AND-ed |
| 934 |
together using commas. The specification \f(CW>= 1.2, != 1.5, < |
| 935 |
2.0\fR indicates a version that must be \fBat least\fR 1.2, \fBless than\fR 2.0, |
| 936 |
and \fBnot equal to\fR 1.5. |
| 937 |
.SH PREREQUISITES |
| 938 |
.IX Header "PREREQUISITES" |
| 939 |
.SS "Prereq Spec" |
| 940 |
.IX Subsection "Prereq Spec" |
| 941 |
The \f(CW\*(C`prereqs\*(C'\fR key in the top-level metadata and within |
| 942 |
\&\f(CW\*(C`optional_features\*(C'\fR define the relationship between a distribution and |
| 943 |
other packages. The prereq spec structure is a hierarchical data |
| 944 |
structure which divides prerequisites into \fIPhases\fR of activity in the |
| 945 |
installation process and \fIRelationships\fR that indicate how |
| 946 |
prerequisites should be resolved. |
| 947 |
.PP |
| 948 |
For example, to specify that \f(CW\*(C`Data::Dumper\*(C'\fR is \f(CW\*(C`required\*(C'\fR during the |
| 949 |
\&\f(CW\*(C`test\*(C'\fR phase, this entry would appear in the distribution metadata: |
| 950 |
.PP |
| 951 |
.Vb 7 |
| 952 |
\& prereqs => { |
| 953 |
\& test => { |
| 954 |
\& requires => { |
| 955 |
\& \*(AqData::Dumper\*(Aq => \*(Aq2.00\*(Aq |
| 956 |
\& } |
| 957 |
\& } |
| 958 |
\& } |
| 959 |
.Ve |
| 960 |
.PP |
| 961 |
\fIPhases\fR |
| 962 |
.IX Subsection "Phases" |
| 963 |
.PP |
| 964 |
Requirements for regular use must be listed in the \f(CW\*(C`runtime\*(C'\fR phase. |
| 965 |
Other requirements should be listed in the earliest stage in which they |
| 966 |
are required and consumers must accumulate and satisfy requirements |
| 967 |
across phases before executing the activity. For example, \f(CW\*(C`build\*(C'\fR |
| 968 |
requirements must also be available during the \f(CW\*(C`test\*(C'\fR phase. |
| 969 |
.PP |
| 970 |
.Vb 4 |
| 971 |
\& before action requirements that must be met |
| 972 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 973 |
\& perl Build.PL configure |
| 974 |
\& perl Makefile.PL |
| 975 |
\& |
| 976 |
\& make configure, runtime, build |
| 977 |
\& Build |
| 978 |
\& |
| 979 |
\& make test configure, runtime, build, test |
| 980 |
\& Build test |
| 981 |
.Ve |
| 982 |
.PP |
| 983 |
Consumers that install the distribution must ensure that |
| 984 |
\&\fIruntime\fR requirements are also installed and may install |
| 985 |
dependencies from other phases. |
| 986 |
.PP |
| 987 |
.Vb 4 |
| 988 |
\& after action requirements that must be met |
| 989 |
\& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- |
| 990 |
\& make install runtime |
| 991 |
\& Build install |
| 992 |
.Ve |
| 993 |
.IP configure 4 |
| 994 |
.IX Item "configure" |
| 995 |
The configure phase occurs before any dynamic configuration has been |
| 996 |
attempted. Libraries required by the configure phase \fBmust\fR be |
| 997 |
available for use before the distribution building tool has been |
| 998 |
executed. |
| 999 |
.IP build 4 |
| 1000 |
.IX Item "build" |
| 1001 |
The build phase is when the distribution's source code is compiled (if |
| 1002 |
necessary) and otherwise made ready for installation. |
| 1003 |
.IP test 4 |
| 1004 |
.IX Item "test" |
| 1005 |
The test phase is when the distribution's automated test suite is run. |
| 1006 |
Any library that is needed only for testing and not for subsequent use |
| 1007 |
should be listed here. |
| 1008 |
.IP runtime 4 |
| 1009 |
.IX Item "runtime" |
| 1010 |
The runtime phase refers not only to when the distribution's contents |
| 1011 |
are installed, but also to its continued use. Any library that is a |
| 1012 |
prerequisite for regular use of this distribution should be indicated |
| 1013 |
here. |
| 1014 |
.IP develop 4 |
| 1015 |
.IX Item "develop" |
| 1016 |
The develop phase's prereqs are libraries needed to work on the |
| 1017 |
distribution's source code as its author does. These tools might be |
| 1018 |
needed to build a release tarball, to run author-only tests, or to |
| 1019 |
perform other tasks related to developing new versions of the |
| 1020 |
distribution. |
| 1021 |
.PP |
| 1022 |
\fIRelationships\fR |
| 1023 |
.IX Subsection "Relationships" |
| 1024 |
.IP requires 4 |
| 1025 |
.IX Item "requires" |
| 1026 |
These dependencies \fBmust\fR be installed for proper completion of the |
| 1027 |
phase. |
| 1028 |
.IP recommends 4 |
| 1029 |
.IX Item "recommends" |
| 1030 |
Recommended dependencies are \fIstrongly\fR encouraged and should be |
| 1031 |
satisfied except in resource constrained environments. |
| 1032 |
.IP suggests 4 |
| 1033 |
.IX Item "suggests" |
| 1034 |
These dependencies are optional, but are suggested for enhanced operation |
| 1035 |
of the described distribution. |
| 1036 |
.IP conflicts 4 |
| 1037 |
.IX Item "conflicts" |
| 1038 |
These libraries cannot be installed when the phase is in operation. |
| 1039 |
This is a very rare situation, and the \f(CW\*(C`conflicts\*(C'\fR relationship should |
| 1040 |
be used with great caution, or not at all. |
| 1041 |
.SS "Merging and Resolving Prerequisites" |
| 1042 |
.IX Subsection "Merging and Resolving Prerequisites" |
| 1043 |
Whenever metadata consumers merge prerequisites, either from different |
| 1044 |
phases or from \f(CW\*(C`optional_features\*(C'\fR, they should merged in a way which |
| 1045 |
preserves the intended semantics of the prerequisite structure. Generally, |
| 1046 |
this means concatenating the version specifications using commas, as |
| 1047 |
described in the "Version Ranges" section. |
| 1048 |
.PP |
| 1049 |
Another subtle error that can occur in resolving prerequisites comes from |
| 1050 |
the way that modules in prerequisites are indexed to distribution files on |
| 1051 |
CPAN. When a module is deleted from a distribution, prerequisites calling |
| 1052 |
for that module could indicate an older distribution should be installed, |
| 1053 |
potentially overwriting files from a newer distribution. |
| 1054 |
.PP |
| 1055 |
For example, as of Oct 31, 2009, the CPAN index file contained these |
| 1056 |
module-distribution mappings: |
| 1057 |
.PP |
| 1058 |
.Vb 3 |
| 1059 |
\& Class::MOP 0.94 D/DR/DROLSKY/Class\-MOP\-0.94.tar.gz |
| 1060 |
\& Class::MOP::Class 0.94 D/DR/DROLSKY/Class\-MOP\-0.94.tar.gz |
| 1061 |
\& Class::MOP::Class::Immutable 0.04 S/ST/STEVAN/Class\-MOP\-0.36.tar.gz |
| 1062 |
.Ve |
| 1063 |
.PP |
| 1064 |
Consider the case where "Class::MOP" 0.94 is installed. If a |
| 1065 |
distribution specified "Class::MOP::Class::Immutable" as a prerequisite, |
| 1066 |
it could result in Class\-MOP\-0.36.tar.gz being installed, overwriting |
| 1067 |
any files from Class\-MOP\-0.94.tar.gz. |
| 1068 |
.PP |
| 1069 |
Consumers of metadata \fBshould\fR test whether prerequisites would result |
| 1070 |
in installed module files being "downgraded" to an older version and |
| 1071 |
\&\fBmay\fR warn users or ignore the prerequisite that would cause such a |
| 1072 |
result. |
| 1073 |
.SH SERIALIZATION |
| 1074 |
.IX Header "SERIALIZATION" |
| 1075 |
Distribution metadata should be serialized (as a hashref) as |
| 1076 |
JSON-encoded data and packaged with distributions as the file |
| 1077 |
\&\fIMETA.json\fR. |
| 1078 |
.PP |
| 1079 |
In the past, the distribution metadata structure had been packed with |
| 1080 |
distributions as \fIMETA.yml\fR, a file in the YAML Tiny format (for which, |
| 1081 |
see YAML::Tiny). Tools that consume distribution metadata from disk |
| 1082 |
should be capable of loading \fIMETA.yml\fR, but should prefer \fIMETA.json\fR |
| 1083 |
if both are found. |
| 1084 |
.SH "NOTES FOR IMPLEMENTORS" |
| 1085 |
.IX Header "NOTES FOR IMPLEMENTORS" |
| 1086 |
.SS "Extracting Version Numbers from Perl Modules" |
| 1087 |
.IX Subsection "Extracting Version Numbers from Perl Modules" |
| 1088 |
To get the version number from a Perl module, consumers should use the |
| 1089 |
\&\f(CW\*(C`MM\->parse_version($file)\*(C'\fR method provided by |
| 1090 |
ExtUtils::MakeMaker or Module::Metadata. For example, for the |
| 1091 |
module given by \f(CW$mod\fR, the version may be retrieved in one of the |
| 1092 |
following ways: |
| 1093 |
.PP |
| 1094 |
.Vb 3 |
| 1095 |
\& # via ExtUtils::MakeMaker |
| 1096 |
\& my $file = MM\->_installed_file_for_module($mod); |
| 1097 |
\& my $version = MM\->parse_version($file) |
| 1098 |
.Ve |
| 1099 |
.PP |
| 1100 |
The private \f(CW\*(C`_installed_file_for_module\*(C'\fR method may be replaced with |
| 1101 |
other methods for locating a module in \f(CW@INC\fR. |
| 1102 |
.PP |
| 1103 |
.Vb 3 |
| 1104 |
\& # via Module::Metadata |
| 1105 |
\& my $info = Module::Metadata\->new_from_module($mod); |
| 1106 |
\& my $version = $info\->version; |
| 1107 |
.Ve |
| 1108 |
.PP |
| 1109 |
If only a filename is available, the following approach may be used: |
| 1110 |
.PP |
| 1111 |
.Vb 3 |
| 1112 |
\& # via Module::Build |
| 1113 |
\& my $info = Module::Metadata\->new_from_file($file); |
| 1114 |
\& my $version = $info\->version; |
| 1115 |
.Ve |
| 1116 |
.SS "Comparing Version Numbers" |
| 1117 |
.IX Subsection "Comparing Version Numbers" |
| 1118 |
The version module provides the most reliable way to compare version |
| 1119 |
numbers in all the various ways they might be provided or might exist |
| 1120 |
within modules. Given two strings containing version numbers, \f(CW$v1\fR and |
| 1121 |
\&\f(CW$v2\fR, they should be converted to \f(CW\*(C`version\*(C'\fR objects before using |
| 1122 |
ordinary comparison operators. For example: |
| 1123 |
.PP |
| 1124 |
.Vb 4 |
| 1125 |
\& use version; |
| 1126 |
\& if ( version\->new($v1) <=> version\->new($v2) ) { |
| 1127 |
\& print "Versions are not equal\en"; |
| 1128 |
\& } |
| 1129 |
.Ve |
| 1130 |
.PP |
| 1131 |
If the only comparison needed is whether an installed module is of a |
| 1132 |
sufficiently high version, a direct test may be done using the string |
| 1133 |
form of \f(CW\*(C`eval\*(C'\fR and the \f(CW\*(C`use\*(C'\fR function. For example, for module \f(CW$mod\fR |
| 1134 |
and version prerequisite \f(CW$prereq\fR: |
| 1135 |
.PP |
| 1136 |
.Vb 3 |
| 1137 |
\& if ( eval "use $mod $prereq (); 1" ) { |
| 1138 |
\& print "Module $mod version is OK.\en"; |
| 1139 |
\& } |
| 1140 |
.Ve |
| 1141 |
.PP |
| 1142 |
If the values of \f(CW$mod\fR and \f(CW$prereq\fR have not been scrubbed, however, |
| 1143 |
this presents security implications. |
| 1144 |
.SS "Prerequisites for dynamically configured distributions" |
| 1145 |
.IX Subsection "Prerequisites for dynamically configured distributions" |
| 1146 |
When \f(CW\*(C`dynamic_config\*(C'\fR is true, it is an error to presume that the |
| 1147 |
prerequisites given in distribution metadata will have any relationship |
| 1148 |
whatsoever to the actual prerequisites of the distribution. |
| 1149 |
.PP |
| 1150 |
In practice, however, one can generally expect such prerequisites to be |
| 1151 |
one of two things: |
| 1152 |
.IP \(bu 4 |
| 1153 |
The minimum prerequisites for the distribution, to which dynamic configuration will only add items |
| 1154 |
.IP \(bu 4 |
| 1155 |
Whatever the distribution configured with on the releaser's machine at release time |
| 1156 |
.PP |
| 1157 |
The second case often turns out to have identical results to the first case, |
| 1158 |
albeit only by accident. |
| 1159 |
.PP |
| 1160 |
As such, consumers may use this data for informational analysis, but |
| 1161 |
presenting it to the user as canonical or relying on it as such is |
| 1162 |
invariably the height of folly. |
| 1163 |
.SS "Indexing distributions a la PAUSE" |
| 1164 |
.IX Subsection "Indexing distributions a la PAUSE" |
| 1165 |
While no_index tells you what must be ignored when indexing, this spec holds |
| 1166 |
no opinion on how you should get your initial candidate list of things to |
| 1167 |
possibly index. For "normal" distributions you might consider simply indexing |
| 1168 |
the contents of lib/, but there are many fascinating oddities on CPAN and |
| 1169 |
many dists from the days when it was normal to put the main .pm file in the |
| 1170 |
root of the distribution archive \- so PAUSE currently indexes all .pm and .PL |
| 1171 |
files that are not either (a) specifically excluded by no_index (b) in |
| 1172 |
\&\f(CW\*(C`inc\*(C'\fR, \f(CW\*(C`xt\*(C'\fR, or \f(CW\*(C`t\*(C'\fR directories, or common 'mistake' directories such as |
| 1173 |
\&\f(CW\*(C`perl5\*(C'\fR. |
| 1174 |
.PP |
| 1175 |
Or: If you're trying to be PAUSE-like, make sure you skip \f(CW\*(C`inc\*(C'\fR, \f(CW\*(C`xt\*(C'\fR and |
| 1176 |
\&\f(CW\*(C`t\*(C'\fR as well as anything marked as no_index. |
| 1177 |
.PP |
| 1178 |
Also remember: If the META file contains a provides field, you shouldn't be |
| 1179 |
indexing anything in the first place \- just use that. |
| 1180 |
.SH "SEE ALSO" |
| 1181 |
.IX Header "SEE ALSO" |
| 1182 |
.IP \(bu 4 |
| 1183 |
CPAN, <http://www.cpan.org/> |
| 1184 |
.IP \(bu 4 |
| 1185 |
JSON, <http://json.org/> |
| 1186 |
.IP \(bu 4 |
| 1187 |
YAML, <http://www.yaml.org/> |
| 1188 |
.IP \(bu 4 |
| 1189 |
CPAN |
| 1190 |
.IP \(bu 4 |
| 1191 |
CPANPLUS |
| 1192 |
.IP \(bu 4 |
| 1193 |
ExtUtils::MakeMaker |
| 1194 |
.IP \(bu 4 |
| 1195 |
Module::Build |
| 1196 |
.IP \(bu 4 |
| 1197 |
Module::Install |
| 1198 |
.IP \(bu 4 |
| 1199 |
CPAN::Meta::History::Meta_1_4 |
| 1200 |
.SH HISTORY |
| 1201 |
.IX Header "HISTORY" |
| 1202 |
Ken Williams wrote the original CPAN Meta Spec (also known as the |
| 1203 |
"META.yml spec") in 2003 and maintained it through several revisions |
| 1204 |
with input from various members of the community. In 2005, Randy |
| 1205 |
Sims redrafted it from HTML to POD for the version 1.2 release. Ken |
| 1206 |
continued to maintain the spec through version 1.4. |
| 1207 |
.PP |
| 1208 |
In late 2009, David Golden organized the version 2 proposal review |
| 1209 |
process. David and Ricardo Signes drafted the final version 2 spec |
| 1210 |
in April 2010 based on the version 1.4 spec and patches contributed |
| 1211 |
during the proposal process. |
| 1212 |
.SH AUTHORS |
| 1213 |
.IX Header "AUTHORS" |
| 1214 |
.IP \(bu 4 |
| 1215 |
David Golden <[email protected]> |
| 1216 |
.IP \(bu 4 |
| 1217 |
Ricardo Signes <[email protected]> |
| 1218 |
.IP \(bu 4 |
| 1219 |
Adam Kennedy <[email protected]> |
| 1220 |
.SH "COPYRIGHT AND LICENSE" |
| 1221 |
.IX Header "COPYRIGHT AND LICENSE" |
| 1222 |
This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors. |
| 1223 |
.PP |
| 1224 |
This is free software; you can redistribute it and/or modify it under |
| 1225 |
the same terms as the Perl 5 programming language system itself. |