1Test::CPAN::Meta::JSON:U:sVeerrsCioonnt(r3i)buted Perl DToecsutm:e:nCtPaAtNi:o:nMeta::JSON::Version(3)
2
3
4
6 Test::CPAN::Meta::JSON::Version - Validate META.json elements.
7
9 use Test::CPAN::Meta::JSON::Version;
10
12 This module was written to ensure that a META.json file, provided with
13 a standard distribution uploaded to CPAN, meets the specifications that
14 are slowly being introduced to module uploads, via the use of
15 ExtUtils::MakeMaker, Module::Build and Module::Install.
16
17 This module is meant to be used together with Test::CPAN::Meta::JSON,
18 however the code is self contained enough that you can access it
19 directly.
20
21 See CPAN::Meta for further details of the CPAN Meta Specification.
22
24 Validation of META.json data against the CPAN Meta Specification.
25
27 · new( data => $data [, spec => $version] )
28
29 The constructor must be passed a valid data structure.
30
31 Optionally you may also provide a specification version. This
32 version is then use to ensure that the given data structure meets
33 the respective META.yml specification definition. If no version is
34 provided the module will attempt to deduce the appropriate
35 specification version from the data structure itself.
36
38 Main Methods
39 · parse()
40
41 Using the given data structure provided with the constructor,
42 attempts to parse and validate according to the appropriate
43 specification definition.
44
45 Returns 1 if any errors found, otherwise returns 0.
46
47 · errors()
48
49 Returns a list of the errors found during parsing.
50
51 Check Methods
52 · check_map($spec,$data)
53
54 Checks whether a map (or hash) part of the data structure conforms
55 to the appropriate specification definition.
56
57 · check_lazylist($spec,$data)
58
59 If it's a string, make it into a list and check the list
60
61 · check_list($spec,$data)
62
63 Checks whether a list (or array) part of the data structure
64 conforms to the appropriate specification definition.
65
66 Validator Methods
67 · url($self,$key,$value)
68
69 Validates that a given value is in an acceptable URL format
70
71 · urlspec($self,$key,$value)
72
73 Validates that the URL to a META.yml specification is a known one.
74
75 · string_or_undef($self,$key,$value)
76
77 Validates that the value is either a string or an undef value. Bit
78 of a catchall function for parts of the data structure that are
79 completely user defined.
80
81 · string($self,$key,$value)
82
83 Validates that a string exists for the given key.
84
85 · file($self,$key,$value)
86
87 Validate that a file is passed for the given key. This may be made
88 more thorough in the future. For now it acts like \&string.
89
90 · exversion($self,$key,$value)
91
92 Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6,
93 0'.
94
95 · version($self,$key,$value)
96
97 Validates a single version string. Versions of the type '5.8.8' and
98 '0.00_00' are both valid. A leading 'v' like 'v1.2.3' is also
99 valid.
100
101 · boolean($self,$key,$value)
102
103 Validates for a boolean value. Currently these values are '1', '0',
104 'true', 'false', however the latter 2 may be removed.
105
106 · license($self,$key,$value)
107
108 Validates that a value is given for the license. Returns 1 if an
109 known license type, or 2 if a value is given but the license type
110 is not a recommended one.
111
112 · resource($self,$key,$value)
113
114 Validates that the given key is in CamelCase, to indicate a user
115 defined keyword.
116
117 · keyword($self,$key,$value)
118
119 Validates that key is in an acceptable format for the META.yml
120 specification, i.e. any in the character class [-_a-z].
121
122 For user defined keys, although not explicitly stated in the
123 specifications (v1.0 - v1.4), the convention is to precede the key
124 with a pattern matching qr{\Ax_}i. Following this any character
125 from the character class [-_a-zA-Z] can be used. This clarification
126 has been added to v2.0 of the specification.
127
128 · identifier($self,$key,$value)
129
130 Validates that key is in an acceptable format for the META.yml
131 specification, for an identifier, i.e. any that matches the regular
132 expression qr/[a-z][a-z_]/i.
133
134 · module($self,$key,$value)
135
136 Validates that a given key is in an acceptable module name format,
137 e.g. 'Test::CPAN::Meta::JSON::Version'.
138
139 · release_status($self,$key,$value)
140
141 Validates that the value for 'release_status' is set appropriately
142 for one of 'stable', 'testing' or 'unstable'.
143
144 · custom_1($self,$key,$value)
145
146 Validates custom keys based on camelcase only.
147
148 · custom_2($self,$key,$value)
149
150 Validates custom keys based on user defined (i.e. /^[xX]_/) only.
151
152 · phase($self,$key,$value)
153
154 Validates for a legal phase of a pre-requisite map.
155
156 · relation($self,$key,$value)
157
158 Validates for a legal relation, within a phase, of a pre-requisite
159 map.
160
161 · anything($self,$key,$value)
162
163 Usually reserved for user defined structures, allowing them to be
164 considered valid without a need for a specification definition for
165 the structure.
166
168 There are no known bugs at the time of this release. However, if you
169 spot a bug or are experiencing difficulties that are not explained
170 within the POD documentation, please send an email to barbie@cpan.org
171 or submit a bug to the RT system
172 (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-JSON).
173 However, it would help greatly if you are able to pinpoint problems or
174 even supply a patch.
175
176 Fixes are dependant upon their severity and my availablity. Should a
177 fix not be forthcoming, please feel free to (politely) remind me.
178
180 b - Beta testing
181 d - Developer
182 p - Perl-only
183 O - Object oriented
184 p - Standard-Perl: user may choose between GPL and Artistic
185
187 Barbie, <barbie@cpan.org> for Miss Barbell Productions,
188 <http://www.missbarbell.co.uk>
189
191 Copyright (C) 2009-2011 Barbie for Miss Barbell Productions
192
193 This module is free software; you can redistribute it and/or
194 modify it under the Artistic Licence v2.
195
196
197
198perl v5.12.3 2011-02-13Test::CPAN::Meta::JSON::Version(3)