Debian Codegraph @

upstream/mageia-cauldron/man3pm/CPAN::Meta::Spec.3pm

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