1Test::CPAN::Meta::JSON:U:sVeerrsCioonnt(r3i)buted Perl DToecsutm:e:nCtPaAtNi:o:nMeta::JSON::Version(3)
2
3
4

NAME

6       Test::CPAN::Meta::JSON::Version - Validate CPAN META data against the
7       specification
8

SYNOPSIS

10         use Test::CPAN::Meta::JSON::Version;
11

DESCRIPTION

13       This module was written to ensure that a META.json file, provided with
14       a standard distribution uploaded to CPAN, meets the specifications that
15       are slowly being introduced to module uploads, via the use of
16       ExtUtils::MakeMaker, Module::Build and Module::Install.
17
18       This module is meant to be used together with Test::CPAN::Meta::JSON,
19       however the code is self contained enough that you can access it
20       directly.
21
22       See CPAN::Meta for further details of the CPAN Meta Specification.
23

ABSTRACT

25       Validation of META.json data against the CPAN Meta Specification.
26

CLASS CONSTRUCTOR

28       •   new( data => $data [, spec => $version] )
29
30           The constructor must be passed a valid data structure.
31
32           Optionally you may also provide a specification version. This
33           version is then use to ensure that the given data structure meets
34           the respective specification definition. If no version is provided
35           the module will attempt to deduce the appropriate specification
36           version from the data structure itself.
37

METHODS

39   Main Methods
40parse()
41
42           Using the given data structure provided with the constructor,
43           attempts to parse and validate according to the appropriate
44           specification definition.
45
46           Returns 1 if any errors found, otherwise returns 0.
47
48errors()
49
50           Returns a list of the errors found during parsing.
51
52   Check Methods
53       •   check_map($spec,$data)
54
55           Checks whether a map (or hash) part of the data structure conforms
56           to the appropriate specification definition.
57
58       •   check_lazylist($spec,$data)
59
60           If it's a string, make it into a list and check the list
61
62       •   check_list($spec,$data)
63
64           Checks whether a list (or array) part of the data structure
65           conforms to the appropriate specification definition.
66
67   Validator Methods
68       •   url($self,$key,$value)
69
70           Validates that a given value is in an acceptable URL format
71
72       •   urlspec($self,$key,$value)
73
74           Validates that the URL to a META.yml specification is a known one.
75
76       •   string_or_undef($self,$key,$value)
77
78           Validates that the value is either a string or an undef value. Bit
79           of a catchall function for parts of the data structure that are
80           completely user defined.
81
82       •   string($self,$key,$value)
83
84           Validates that a string exists for the given key.
85
86       •   file($self,$key,$value)
87
88           Validate that a file is passed for the given key. This may be made
89           more thorough in the future. For now it acts like \&string.
90
91       •   exversion($self,$key,$value)
92
93           Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6,
94           0'.
95
96       •   version($self,$key,$value)
97
98           Validates a single version string. Versions of the type '5.8.8' and
99           '0.00_00' are both valid. A leading 'v' like 'v1.2.3' is also
100           valid.
101
102       •   boolean($self,$key,$value)
103
104           Validates for a boolean value. Currently these values are '1', '0',
105           'true', 'false', however the latter 2 may be removed.
106
107       •   license($self,$key,$value)
108
109           Validates that a value is given for the license. Returns 1 if an
110           known license type, or 2 if a value is given but the license type
111           is not a recommended one.
112
113       •   resource($self,$key,$value)
114
115           Validates that the given key is in CamelCase, to indicate a user
116           defined keyword.
117
118       •   keyword($self,$key,$value)
119
120           Validates that key is in an acceptable format for the META.yml
121           specification, i.e. any in the character class [-_a-z].
122
123           For user defined keys, although not explicitly stated in the
124           specifications (v1.0 - v1.4), the convention is to precede the key
125           with a pattern matching qr{\Ax_}i. Following this any character
126           from the character class [-_a-zA-Z] can be used. This clarification
127           has been added to v2.0 of the specification.
128
129       •   identifier($self,$key,$value)
130
131           Validates that key is in an acceptable format for the META.yml
132           specification, for an identifier, i.e. any that matches the regular
133           expression qr/[a-z][a-z_]/i.
134
135       •   module($self,$key,$value)
136
137           Validates that a given key is in an acceptable module name format,
138           e.g.  'Test::CPAN::Meta::JSON::Version'.
139
140       •   release_status($self,$key,$value)
141
142           Validates that the value for 'release_status' is set appropriately
143           for one of 'stable', 'testing' or 'unstable'.
144
145       •   custom_1($self,$key,$value)
146
147           Validates custom keys based on camelcase only.
148
149       •   custom_2($self,$key,$value)
150
151           Validates custom keys based on user defined (i.e. /^[xX]_/) only.
152
153       •   phase($self,$key,$value)
154
155           Validates for a legal phase of a pre-requisite map.
156
157       •   relation($self,$key,$value)
158
159           Validates for a legal relation, within a phase, of a pre-requisite
160           map.
161
162       •   anything($self,$key,$value)
163
164           Usually reserved for user defined structures, allowing them to be
165           considered valid without a need for a specification definition for
166           the structure.
167

BUGS, PATCHES & FIXES

169       There are no known bugs at the time of this release. However, if you
170       spot a bug or are experiencing difficulties that are not explained
171       within the POD documentation, please send an email to barbie@cpan.org
172       or submit a bug to the RT system
173       (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-JSON).
174       However, it would help greatly if you are able to pinpoint problems or
175       even supply a patch.
176
177       Fixes are dependent upon their severity and my availability. Should a
178       fix not be forthcoming, please feel free to (politely) remind me.
179

AUTHOR

181       Barbie, <barbie@cpan.org> for Miss Barbell Productions,
182       <http://www.missbarbell.co.uk>
183
185         Copyright (C) 2009-2015 Barbie for Miss Barbell Productions
186
187         This distribution is free software; you can redistribute it and/or
188         modify it under the Artistic Licence v2.
189
190
191
192perl v5.32.1                      2021-01-27Test::CPAN::Meta::JSON::Version(3)
Impressum