5 package CPAN::Meta::Spec;
6 our $VERSION = '2.130880'; # VERSION
10 # ABSTRACT: specification for CPAN distribution metadata
20 CPAN::Meta::Spec - specification for CPAN distribution metadata
29 name => 'Module-Build',
30 abstract => 'Build and install Perl modules',
31 description => "Module::Build is a system for "
32 . "building, testing, and installing Perl modules. "
33 . "It is meant to ... blah blah blah ...",
35 release_status => 'stable',
37 'Ken Williams <kwilliams@cpan.org>',
38 'Module-Build List <module-build@perl.org>', # additional contact
40 license => [ 'perl_5' ],
45 'ExtUtils::Install' => '0',
46 'File::Basename' => '0',
47 'File::Compare' => '0',
51 'Archive::Tar' => '1.00',
52 'ExtUtils::Install' => '0.3',
53 'ExtUtils::ParseXS' => '2.02',
63 license => ['http://dev.perl.org/licenses/'],
65 optional_features => {
67 description => 'Take over the world',
69 develop => { requires => { 'Genius::Evil' => '1.234' } },
70 runtime => { requires => { 'Machine::Weather' => '2.0' } },
75 keywords => [ qw/ toolchain cpan dual-life / ],
78 url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
80 generated_by => 'Module::Build version 0.36',
85 This document describes version 2 of the CPAN distribution metadata
86 specification, also known as the "CPAN Meta Spec".
88 Revisions of this specification for typo corrections and prose
89 clarifications may be issued as CPAN::Meta::Spec 2.I<x>. These
90 revisions will never change semantics or add or remove specified
93 Distribution metadata describe important properties of Perl
94 distributions. Distribution building tools like Module::Build,
95 Module::Install, ExtUtils::MakeMaker or Dist::Zilla should create a
96 metadata file in accordance with this specification and include it with
97 the distribution for use by automated tools that index, examine, package
98 or install Perl distributions.
106 This is the primary object described by the metadata. In the context of
107 this document it usually refers to a collection of modules, scripts,
108 and/or documents that are distributed together for other developers to
109 use. Examples of distributions are C<Class-Container>, C<libwww-perl>,
114 This refers to a reusable library of code contained in a single file.
115 Modules usually contain one or more packages and are often referred
116 to by the name of a primary package that can be mapped to the file
117 name. For example, one might refer to C<File::Spec> instead of
122 This refers to a namespace declared with the Perl C<package> statement.
123 In Perl, packages often have a version number property given by the
124 C<$VERSION> variable in the namespace.
128 This refers to code that reads a metadata file, deserializes it into a
129 data structure in memory, or interprets a data structure of metadata
134 This refers to code that constructs a metadata data structure,
135 serializes into a bytestream and/or writes it to disk.
137 =item must, should, may, etc.
139 These terms are interpreted as described in IETF RFC 2119.
145 Fields in the L</STRUCTURE> section describe data elements, each of
146 which has an associated data type as described herein. There are four
147 primitive types: Boolean, String, List and Map. Other types are
148 subtypes of primitives and define compound data structures or define
149 constraints on the values of a data element.
153 A I<Boolean> is used to provide a true or false value. It B<must> be
154 represented as a defined value.
158 A I<String> is data element containing a non-zero length sequence of
159 Unicode characters, such as an ordinary Perl scalar that is not a
164 A I<List> is an ordered collection of zero or more data elements.
165 Elements of a List may be of mixed types.
167 Producers B<must> represent List elements using a data structure which
168 unambiguously indicates that multiple values are possible, such as a
169 reference to a Perl array (an "arrayref").
171 Consumers expecting a List B<must> consider a String as equivalent to a
176 A I<Map> is an unordered collection of zero or more data elements
177 ("values"), indexed by associated String elements ("keys"). The Map's
178 value elements may be of mixed types.
180 =head2 License String
182 A I<License String> is a subtype of String with a restricted set of
183 values. Valid values are described in detail in the description of
184 the L</license> field.
188 I<URL> is a subtype of String containing a Uniform Resource Locator or
189 Identifier. [ This type is called URL and not URI for historical reasons. ]
193 A I<Version> is a subtype of String containing a value that describes
194 the version number of packages or distributions. Restrictions on format
195 are described in detail in the L</Version Formats> section.
199 The I<Version Range> type is a subtype of String. It describes a range
200 of Versions that may be present or installed to fulfill prerequisites.
201 It is specified in detail in the L</Version Ranges> section.
205 The metadata structure is a data element of type Map. This section
206 describes valid keys within the Map.
208 Any keys not described in this specification document (whether top-level
209 or within compound data structures described herein) are considered
210 I<custom keys> and B<must> begin with an "x" or "X" and be followed by an
211 underscore; i.e. they must match the pattern: C<< qr{\Ax_}i >>. If a
212 custom key refers to a compound data structure, subkeys within it do not
213 need an "x_" or "X_" prefix.
215 Consumers of metadata may ignore any or all custom keys. All other keys
216 not described herein are invalid and should be ignored by consumers.
217 Producers must not generate or output invalid keys.
219 For each key, an example is provided followed by a description. The
220 description begins with the version of spec in which the key was added
221 or in which the definition was modified, whether the key is I<required>
222 or I<optional> and the data type of the corresponding data element.
223 These items are in parentheses, brackets and braces, respectively.
225 If a data type is a Map or Map subtype, valid subkeys will be described
228 Some fields are marked I<Deprecated>. These are shown for historical
229 context and must not be produced in or consumed from any metadata structure
230 of version 2 or higher.
232 =head2 REQUIRED FIELDS
238 abstract => 'Build and install Perl modules'
240 (Spec 1.2) [required] {String}
242 This is a short description of the purpose of the distribution.
248 author => [ 'Ken Williams <kwilliams@cpan.org>' ]
250 (Spec 1.2) [required] {List of one or more Strings}
252 This List indicates the person(s) to contact concerning the
253 distribution. The preferred form of the contact string is:
255 contact-name <email-address>
257 This field provides a general contact list independent of other
258 structured fields provided within the L</resources> field, such as
259 C<bugtracker>. The addressee(s) can be contacted for any purpose
260 including but not limited to (security) problems with the distribution,
261 questions about the distribution or bugs in the distribution.
263 A distribution's original author is usually the contact listed within
264 this field. Co-maintainers, successor maintainers or mailing lists
265 devoted to the distribution may also be listed in addition to or instead
266 of the original author.
268 =head3 dynamic_config
274 (Spec 2) [required] {Boolean}
276 A boolean flag indicating whether a F<Build.PL> or F<Makefile.PL> (or
277 similar) must be executed to determine prerequisites.
279 This field should be set to a true value if the distribution performs
280 some dynamic configuration (asking questions, sensing the environment,
281 etc.) as part of its configuration. This field should be set to a false
282 value to indicate that prerequisites included in metadata may be
283 considered final and valid for static analysis.
285 This field explicitly B<does not> indicate whether installation may be
286 safely performed without using a Makefile or Build file, as there may be
287 special files to install or custom installation targets (e.g. for
288 dual-life modules that exist on CPAN as well as in the Perl core). This
289 field only defines whether prerequisites are complete as given in the
296 generated_by => 'Module::Build version 0.36'
298 (Spec 1.0) [required] {String}
300 This field indicates the tool that was used to create this metadata.
301 There are no defined semantics for this field, but it is traditional to
302 use a string in the form "Generating::Package version 1.23" or the
303 author's name, if the file was generated by hand.
309 license => [ 'perl_5' ]
311 license => [ 'apache_2', 'mozilla_1_0' ]
313 (Spec 2) [required] {List of one or more License Strings}
315 One or more licenses that apply to some or all of the files in the
316 distribution. If multiple licenses are listed, the distribution
317 documentation should be consulted to clarify the interpretation of
320 The following list of license strings are valid:
323 ------------- -----------------------------------------------
324 agpl_3 GNU Affero General Public License, Version 3
325 apache_1_1 Apache Software License, Version 1.1
326 apache_2_0 Apache License, Version 2.0
327 artistic_1 Artistic License, (Version 1)
328 artistic_2 Artistic License, Version 2.0
329 bsd BSD License (three-clause)
330 freebsd FreeBSD License (two-clause)
331 gfdl_1_2 GNU Free Documentation License, Version 1.2
332 gfdl_1_3 GNU Free Documentation License, Version 1.3
333 gpl_1 GNU General Public License, Version 1
334 gpl_2 GNU General Public License, Version 2
335 gpl_3 GNU General Public License, Version 3
336 lgpl_2_1 GNU Lesser General Public License, Version 2.1
337 lgpl_3_0 GNU Lesser General Public License, Version 3.0
338 mit MIT (aka X11) License
339 mozilla_1_0 Mozilla Public License, Version 1.0
340 mozilla_1_1 Mozilla Public License, Version 1.1
341 openssl OpenSSL License
342 perl_5 The Perl 5 License (Artistic 1 & GPL 1 or later)
343 qpl_1_0 Q Public License, Version 1.0
344 ssleay Original SSLeay License
345 sun Sun Internet Standards Source License (SISSL)
348 The following license strings are also valid and indicate other
349 licensing not described above:
352 ------------- -----------------------------------------------
353 open_source Other Open Source Initiative (OSI) approved license
354 restricted Requires special permission from copyright holder
355 unrestricted Not an OSI approved license, but not restricted
356 unknown License not provided in metadata
358 All other strings are invalid in the license field.
366 url => 'http://search.cpan.org/perldoc?CPAN::Meta::Spec',
369 (Spec 1.2) [required] {Map}
371 This field indicates the version of the CPAN Meta Spec that should be
372 used to interpret the metadata. Consumers must check this key as soon
373 as possible and abort further metadata processing if the meta-spec
374 version is not supported by the consumer.
376 The following keys are valid, but only C<version> is required.
382 This subkey gives the integer I<Version> of the CPAN Meta Spec against
383 which the document was generated.
387 This is a I<URL> of the metadata specification document corresponding to
388 the given version. This is strictly for human-consumption and should
389 not impact the interpretation of the document.
397 name => 'Module-Build'
399 (Spec 1.0) [required] {String}
401 This field is the name of the distribution. This is often created by
402 taking the "main package" in the distribution and changing C<::> to
403 C<->, but the name may be completely unrelated to the packages within
404 the distribution. C.f. L<http://search.cpan.org/dist/libwww-perl/>.
406 =head3 release_status
410 release_status => 'stable'
412 (Spec 2) [required] {String}
414 This field provides the release status of this distribution. If the
415 C<version> field contains an underscore character, then
416 C<release_status> B<must not> be "stable."
418 The C<release_status> field B<must> have one of the following values:
424 This indicates an ordinary, "final" release that should be indexed by PAUSE
429 This indicates a "beta" release that is substantially complete, but has an
430 elevated risk of bugs and requires additional testing. The distribution
431 should not be installed over a stable release without an explicit request
432 or other confirmation from a user. This release status may also be used
433 for "release candidate" versions of a distribution.
437 This indicates an "alpha" release that is under active development, but has
438 been released for early feedback or testing and may be missing features or
439 may have serious bugs. The distribution should not be installed over a
440 stable release without an explicit request or other confirmation from a
445 Consumers B<may> use this field to determine how to index the
446 distribution for CPAN or other repositories in addition to or in
447 replacement of heuristics based on version number or file name.
455 (Spec 1.0) [required] {Version}
457 This field gives the version of the distribution to which the metadata
460 =head2 OPTIONAL FIELDS
466 description => "Module::Build is a system for "
467 . "building, testing, and installing Perl modules. "
468 . "It is meant to ... blah blah blah ...",
470 (Spec 2) [optional] {String}
472 A longer, more complete description of the purpose or intended use of
473 the distribution than the one provided by the C<abstract> key.
479 keywords => [ qw/ toolchain cpan dual-life / ]
481 (Spec 1.1) [optional] {List of zero or more Strings}
483 A List of keywords that describe this distribution. Keywords
484 B<must not> include whitespace.
491 file => [ 'My/Module.pm' ],
492 directory => [ 'My/Private' ],
493 package => [ 'My::Module::Secret' ],
494 namespace => [ 'My::Module::Sample' ],
497 (Spec 1.2) [optional] {Map}
499 This Map describes any files, directories, packages, and namespaces that
500 are private to the packaging or implementation of the distribution and
501 should be ignored by indexing or search tools.
503 Valid subkeys are as follows:
509 A I<List> of relative paths to files. Paths B<must be> specified with
514 A I<List> of relative paths to directories. Paths B<must be> specified
515 with unix conventions.
517 [ Note: previous editions of the spec had C<dir> instead of C<directory> ]
521 A I<List> of package names.
525 A I<List> of package namespaces, where anything below the namespace
526 must be ignored, but I<not> the namespace itself.
528 In the example above for C<no_index>, C<My::Module::Sample::Foo> would
529 be ignored, but C<My::Module::Sample> would not.
533 =head3 optional_features
537 optional_features => {
539 description => 'Provides SQLite support',
543 'DBD::SQLite' => '1.25'
550 (Spec 2) [optional] {Map}
552 This Map describes optional features with incremental prerequisites.
553 Each key of the C<optional_features> Map is a String used to identify
554 the feature and each value is a Map with additional information about
555 the feature. Valid subkeys include:
561 This is a String describing the feature. Every optional feature
562 should provide a description
566 This entry is required and has the same structure as that of the
567 C<L</prereqs>> key. It provides a list of package requirements
568 that must be satisfied for the feature to be supported or enabled.
570 There is one crucial restriction: the prereqs of an optional feature
571 B<must not> include C<configure> phase prereqs.
575 Consumers B<must not> include optional features as prerequisites without
576 explicit instruction from users (whether via interactive prompting,
577 a function parameter or a configuration value, etc. ).
579 If an optional feature is used by a consumer to add additional
580 prerequisites, the consumer should merge the optional feature
581 prerequisites into those given by the C<prereqs> key using the same
582 semantics. See L</Merging and Resolving Prerequisites> for details on
583 merging prerequisites.
585 I<Suggestion for disuse:> Because there is currently no way for a
586 distribution to specify a dependency on an optional feature of another
587 dependency, the use of C<optional_feature> is discouraged. Instead,
588 create a separate, installable distribution that ensures the desired
589 feature is available. For example, if C<Foo::Bar> has a "Baz" feature,
590 release a separate C<Foo-Bar-Baz> distribution that satisfies
591 requirements for the feature.
601 'File::Spec' => '0.86',
605 'JSON::XS' => '2.26',
608 'Archive::Tar' => '0',
613 'Alien::SDL' => '1.00',
618 'Test::Deep' => '0.10',
623 (Spec 2) [optional] {Map}
625 This is a Map that describes all the prerequisites of the distribution.
626 The keys are phases of activity, such as C<configure>, C<build>, C<test>
627 or C<runtime>. Values are Maps in which the keys name the type of
628 prerequisite relationship such as C<requires>, C<recommends>, or
629 C<suggests> and the value provides a set of prerequisite relations. The
630 set of relations B<must> be specified as a Map of package names to
633 The full definition for this field is given in the L</Prereq Spec>
642 file => 'lib/Foo/Bar.pm',
645 'Foo::Bar::Blah' => {
646 file => 'lib/Foo/Bar/Blah.pm',
649 file => 'lib/Foo/Bar/Baz.pm',
654 (Spec 1.2) [optional] {Map}
656 This describes all packages provided by this distribution. This
657 information is used by distribution and automation mechanisms like
658 PAUSE, CPAN, and search.cpan.org to build indexes saying in which
659 distribution various packages can be found.
661 The keys of C<provides> are package names that can be found within
662 the distribution. The values are Maps with the following valid subkeys:
668 This field is required. The value must contain a Unix-style relative
669 file path from the root of the distribution to the module containing the
674 This field contains a I<Version> String for the package, if one exists.
683 license => [ 'http://dev.perl.org/licenses/' ],
684 homepage => 'http://sourceforge.net/projects/module-build',
686 web => 'http://rt.cpan.org/Public/Dist/Display.html?Name=CPAN-Meta',
687 mailto => 'meta-bugs@example.com',
690 url => 'git://github.com/dagolden/cpan-meta.git',
691 web => 'http://github.com/dagolden/cpan-meta',
694 x_twitter => 'http://twitter.com/cpan_linked/',
697 (Spec 2) [optional] {Map}
699 This field describes resources related to this distribution.
701 Valid subkeys include:
707 The official home of this project on the web.
711 A List of I<URL>'s that relate to this distribution's license. As with the
712 top-level C<license> field, distribution documentation should be consulted
713 to clarify the interpretation of multiple licenses provided here.
717 This entry describes the bug tracking system for this distribution. It
718 is a Map with the following valid keys:
720 web - a URL pointing to a web front-end for the bug tracker
721 mailto - an email address to which bugs can be sent
725 This entry describes the source control repository for this distribution. It
726 is a Map with the following valid keys:
728 url - a URL pointing to the repository itself
729 web - a URL pointing to a web front-end for the repository
730 type - a lowercase string indicating the VCS used
732 Because a url like C<http://myrepo.example.com/> is ambiguous as to
733 type, producers should provide a C<type> whenever a C<url> key is given.
734 The C<type> field should be the name of the most common program used
735 to work with the repository, e.g. git, svn, cvs, darcs, bzr or hg.
739 =head2 DEPRECATED FIELDS
741 =head3 build_requires
743 I<(Deprecated in Spec 2)> [optional] {String}
745 Replaced by C<prereqs>
747 =head3 configure_requires
749 I<(Deprecated in Spec 2)> [optional] {String}
751 Replaced by C<prereqs>
755 I<(Deprecated in Spec 2)> [optional] {String}
757 Replaced by C<prereqs>
759 =head3 distribution_type
761 I<(Deprecated in Spec 2)> [optional] {String}
763 This field indicated 'module' or 'script' but was considered
764 meaningless, since many distributions are hybrids of several kinds of
769 I<(Deprecated in Spec 1.2)> [optional] {URL}
771 Replaced by C<license> in C<resources>
775 I<(Deprecated in Spec 1.2)> [optional] {Map}
777 This field has been renamed to L</"no_index">.
781 I<(Deprecated in Spec 2)> [optional] {String}
783 Replaced by C<prereqs>
787 I<(Deprecated in Spec 2)> [optional] {String}
789 Replaced by C<prereqs>
791 =head1 VERSION NUMBERS
793 =head2 Version Formats
795 This section defines the Version type, used by several fields in the
798 Version numbers must be treated as strings, not numbers. For
799 example, C<1.200> B<must not> be serialized as C<1.2>. Version
800 comparison should be delegated to the Perl L<version> module, version
803 Unless otherwise specified, version numbers B<must> appear in one of two
808 =item Decimal versions
810 Decimal versions are regular "decimal numbers", with some limitations.
811 They B<must> be non-negative and B<must> begin and end with a digit. A
812 single underscore B<may> be included, but B<must> be between two digits.
813 They B<must not> use exponential notation ("1.23e-2").
815 version => '1.234' # OK
816 version => '1.23_04' # OK
818 version => '1.23_04_05' # Illegal
819 version => '1.' # Illegal
820 version => '.1' # Illegal
822 =item Dotted-integer versions
824 Dotted-integer (also known as dotted-decimal) versions consist of
825 positive integers separated by full stop characters (i.e. "dots",
826 "periods" or "decimal points"). This are equivalent in format to Perl
827 "v-strings", with some additional restrictions on form. They must be
828 given in "normal" form, which has a leading "v" character and at least
829 three integer components. To retain a one-to-one mapping with decimal
830 versions, all components after the first B<should> be restricted to the
831 range 0 to 999. The final component B<may> be separated by an
832 underscore character instead of a period.
834 version => 'v1.2.3' # OK
835 version => 'v1.2_3' # OK
836 version => 'v1.2.3.4' # OK
837 version => 'v1.2.3_4' # OK
838 version => 'v2009.10.31' # OK
840 version => 'v1.2' # Illegal
841 version => '1.2.3' # Illegal
842 version => 'v1.2_3_4' # Illegal
843 version => 'v1.2009.10.31' # Not recommended
847 =head2 Version Ranges
849 Some fields (prereq, optional_features) indicate the particular
850 version(s) of some other module that may be required as a prerequisite.
851 This section details the Version Range type used to provide this
854 The simplest format for a Version Range is just the version
855 number itself, e.g. C<2.4>. This means that B<at least> version 2.4
856 must be present. To indicate that B<any> version of a prerequisite is
857 okay, even if the prerequisite doesn't define a version at all, use
860 Alternatively, a version range B<may> use the operators E<lt> (less than),
861 E<lt>= (less than or equal), E<gt> (greater than), E<gt>= (greater than
862 or equal), == (equal), and != (not equal). For example, the
863 specification C<E<lt> 2.0> means that any version of the prerequisite
864 less than 2.0 is suitable.
866 For more complicated situations, version specifications B<may> be AND-ed
867 together using commas. The specification C<E<gt>= 1.2, != 1.5, E<lt>
868 2.0> indicates a version that must be B<at least> 1.2, B<less than> 2.0,
869 and B<not equal to> 1.5.
875 The C<prereqs> key in the top-level metadata and within
876 C<optional_features> define the relationship between a distribution and
877 other packages. The prereq spec structure is a hierarchical data
878 structure which divides prerequisites into I<Phases> of activity in the
879 installation process and I<Relationships> that indicate how
880 prerequisites should be resolved.
882 For example, to specify that C<Data::Dumper> is C<required> during the
883 C<test> phase, this entry would appear in the distribution metadata:
888 'Data::Dumper' => '2.00'
895 Requirements for regular use must be listed in the C<runtime> phase.
896 Other requirements should be listed in the earliest stage in which they
897 are required and consumers must accumulate and satisfy requirements
898 across phases before executing the activity. For example, C<build>
899 requirements must also be available during the C<test> phase.
901 before action requirements that must be met
902 ---------------- --------------------------------
903 perl Build.PL configure
906 make configure, runtime, build
909 make test configure, runtime, build, test
912 Consumers that install the distribution must ensure that
913 I<runtime> requirements are also installed and may install
914 dependencies from other phases.
916 after action requirements that must be met
917 ---------------- --------------------------------
925 The configure phase occurs before any dynamic configuration has been
926 attempted. Libraries required by the configure phase B<must> be
927 available for use before the distribution building tool has been
932 The build phase is when the distribution's source code is compiled (if
933 necessary) and otherwise made ready for installation.
937 The test phase is when the distribution's automated test suite is run.
938 Any library that is needed only for testing and not for subsequent use
939 should be listed here.
943 The runtime phase refers not only to when the distribution's contents
944 are installed, but also to its continued use. Any library that is a
945 prerequisite for regular use of this distribution should be indicated
950 The develop phase's prereqs are libraries needed to work on the
951 distribution's source code as its author does. These tools might be
952 needed to build a release tarball, to run author-only tests, or to
953 perform other tasks related to developing new versions of the
964 These dependencies B<must> be installed for proper completion of the
969 Recommended dependencies are I<strongly> encouraged and should be
970 satisfied except in resource constrained environments.
974 These dependencies are optional, but are suggested for enhanced operation
975 of the described distribution.
979 These libraries cannot be installed when the phase is in operation.
980 This is a very rare situation, and the C<conflicts> relationship should
981 be used with great caution, or not at all.
985 =head2 Merging and Resolving Prerequisites
987 Whenever metadata consumers merge prerequisites, either from different
988 phases or from C<optional_features>, they should merged in a way which
989 preserves the intended semantics of the prerequisite structure. Generally,
990 this means concatenating the version specifications using commas, as
991 described in the L<Version Ranges> section.
993 Another subtle error that can occur in resolving prerequisites comes from
994 the way that modules in prerequisites are indexed to distribution files on
995 CPAN. When a module is deleted from a distribution, prerequisites calling
996 for that module could indicate an older distribution should installed,
997 potentially overwriting files from a newer distribution.
999 For example, as of Oct 31, 2009, the CPAN index file contained these
1000 module-distribution mappings:
1002 Class::MOP 0.94 D/DR/DROLSKY/Class-MOP-0.94.tar.gz
1003 Class::MOP::Class 0.94 D/DR/DROLSKY/Class-MOP-0.94.tar.gz
1004 Class::MOP::Class::Immutable 0.04 S/ST/STEVAN/Class-MOP-0.36.tar.gz
1006 Consider the case where "Class::MOP" 0.94 is installed. If a
1007 distribution specified "Class::MOP::Class::Immutable" as a prerequisite,
1008 it could result in Class-MOP-0.36.tar.gz being installed, overwriting
1009 any files from Class-MOP-0.94.tar.gz.
1011 Consumers of metadata B<should> test whether prerequisites would result
1012 in installed module files being "downgraded" to an older version and
1013 B<may> warn users or ignore the prerequisite that would cause such a
1016 =head1 SERIALIZATION
1018 Distribution metadata should be serialized (as a hashref) as
1019 JSON-encoded data and packaged with distributions as the file
1022 In the past, the distribution metadata structure had been packed with
1023 distributions as F<META.yml>, a file in the YAML Tiny format (for which,
1024 see L<YAML::Tiny>). Tools that consume distribution metadata from disk
1025 should be capable of loading F<META.yml>, but should prefer F<META.json>
1028 =head1 NOTES FOR IMPLEMENTORS
1030 =head2 Extracting Version Numbers from Perl Modules
1032 To get the version number from a Perl module, consumers should use the
1033 C<< MM->parse_version($file) >> method provided by
1034 L<ExtUtils::MakeMaker> or L<Module::Metadata>. For example, for the
1035 module given by C<$mod>, the version may be retrieved in one of the
1038 # via ExtUtils::MakeMaker
1039 my $file = MM->_installed_file_for_module($mod);
1040 my $version = MM->parse_version($file)
1042 The private C<_installed_file_for_module> method may be replaced with
1043 other methods for locating a module in C<@INC>.
1045 # via Module::Metadata
1046 my $info = Module::Metadata->new_from_module($mod);
1047 my $version = $info->version;
1049 If only a filename is available, the following approach may be used:
1052 my $info = Module::Metadata->new_from_file($file);
1053 my $version = $info->version;
1055 =head2 Comparing Version Numbers
1057 The L<version> module provides the most reliable way to compare version
1058 numbers in all the various ways they might be provided or might exist
1059 within modules. Given two strings containing version numbers, C<$v1> and
1060 C<$v2>, they should be converted to C<version> objects before using
1061 ordinary comparison operators. For example:
1064 if ( version->new($v1) <=> version->new($v2) ) {
1065 print "Versions are not equal\n";
1068 If the only comparison needed is whether an installed module is of a
1069 sufficiently high version, a direct test may be done using the string
1070 form of C<eval> and the C<use> function. For example, for module C<$mod>
1071 and version prerequisite C<$prereq>:
1073 if ( eval "use $mod $prereq (); 1" ) {
1074 print "Module $mod version is OK.\n";
1077 If the values of C<$mod> and C<$prereq> have not been scrubbed, however,
1078 this presents security implications.
1082 CPAN, L<http://www.cpan.org/>
1084 CPAN.pm, L<http://search.cpan.org/dist/CPAN/>
1086 CPANPLUS, L<http://search.cpan.org/dist/CPANPLUS/>
1088 ExtUtils::MakeMaker, L<http://search.cpan.org/dist/ExtUtils-MakeMaker/>
1090 Module::Build, L<http://search.cpan.org/dist/Module-Build/>
1092 Module::Install, L<http://search.cpan.org/dist/Module-Install/>
1094 JSON, L<http://json.org/>
1096 YAML, L<http://www.yaml.org/>
1100 Ken Williams wrote the original CPAN Meta Spec (also known as the
1101 "META.yml spec") in 2003 and maintained it through several revisions
1102 with input from various members of the community. In 2005, Randy
1103 Sims redrafted it from HTML to POD for the version 1.2 release. Ken
1104 continued to maintain the spec through version 1.4.
1106 In late 2009, David Golden organized the version 2 proposal review
1107 process. David and Ricardo Signes drafted the final version 2 spec
1108 in April 2010 based on the version 1.4 spec and patches contributed
1109 during the proposal process.
1111 Several others have contributed patches over the years. The full list
1112 of contributors in the repository history currently includes:
1115 Avar Arnfjord Bjarmason
1116 Christopher J. Madsen
1132 David Golden <dagolden@cpan.org>
1136 Ricardo Signes <rjbs@cpan.org>
1146 Ansgar Burchardt <ansgar@cpan.org>
1150 Michael G. Schwern <mschwern@cpan.org>
1154 Randy Sims <randys@thepierianspring.org>
1158 Ævar Arnfjörð Bjarmason <avar@cpan.org>
1162 Christopher J. Madsen <cjm@cpan.org>
1166 Cory G Watson <gphat@cpan.org>
1170 Damyan Ivanov <dam@cpan.org>
1174 Eric Wilhelm <ewilhelm@cpan.org>
1178 Gregor Hermann <gregoa@debian.org>
1182 Ken Williams <kwilliams@cpan.org>
1186 Lars Dɪᴇᴄᴋᴏᴡ 迪拉斯 <daxim@cpan.org>
1190 Leon Timmermans <leont@cpan.org>
1194 Mark Fowler <markf@cpan.org>
1198 =head1 COPYRIGHT AND LICENSE
1200 This software is copyright (c) 2010 by David Golden and Ricardo Signes.
1202 This is free software; you can redistribute it and/or modify it under
1203 the same terms as the Perl 5 programming language system itself.