1Test::CPAN::Meta::YAML:U:sVeerrsCioonnt(r3i)buted Perl DToecsutm:e:nCtPaAtNi:o:nMeta::YAML::Version(3)
2
3
4
6 Test::CPAN::Meta::YAML::Version - Validate CPAN META data against the
7 specification
8
10 use Test::CPAN::Meta::YAML::Version;
11
13 This module was written to ensure that a META.yml file, provided with a
14 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::YAML,
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
25 Validation of META.yml data against the CPAN Meta Specification.
26
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
39 Main Methods
40 • parse()
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
48 • errors()
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_list($spec,$data)
59
60 Checks whether a list (or array) part of the data structure
61 conforms to the appropriate specification definition.
62
63 Validator Methods
64 • header($self,$key,$value)
65
66 Validates that the YAML header is valid.
67
68 Note: No longer used as we now read the YAML data structure, not
69 the file.
70
71 • url($self,$key,$value)
72
73 Validates that a given value is in an acceptable URL format
74
75 • urlspec($self,$key,$value)
76
77 Validates that the URL to a META.yml specification is a known one.
78
79 • string_or_undef($self,$key,$value)
80
81 Validates that the value is either a string or an undef value. Bit
82 of a catchall function for parts of the data structure that are
83 completely user defined.
84
85 • string($self,$key,$value)
86
87 Validates that a string exists for the given key.
88
89 • file($self,$key,$value)
90
91 Validate that a file is passed for the given key. This may be made
92 more thorough in the future. For now it acts like \&string.
93
94 • exversion($self,$key,$value)
95
96 Validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6,
97 0'.
98
99 • version($self,$key,$value)
100
101 Validates a single version string. Versions of the type '5.8.8' and
102 '0.00_00' are both valid. A leading 'v' like 'v1.2.3' is also
103 valid.
104
105 • boolean($self,$key,$value)
106
107 Validates for a boolean value. Currently these values are '1', '0',
108 'true', 'false', however the latter 2 may be removed.
109
110 • license($self,$key,$value)
111
112 Validates that a value is given for the license. Returns 1 if an
113 known license type, or 2 if a value is given but the license type
114 is not a recommended one.
115
116 • resource($self,$key,$value)
117
118 Validates that the given key is in CamelCase, to indicate a user
119 defined keyword.
120
121 • keyword($self,$key,$value)
122
123 Validates that key is in an acceptable format for the META.yml
124 specification, i.e. any in the character class [-_a-z].
125
126 For user defined keys, although not explicitly stated in the
127 specifications (v1.0 - v1.4), the convention is to precede the key
128 with a pattern matching qr{\Ax_}i. Following this any character
129 from the character class [-_a-zA-Z] can be used. This clarification
130 has been added to v2.0 of the specification.
131
132 • identifier($self,$key,$value)
133
134 Validates that key is in an acceptable format for the META.yml
135 specification, for an identifier, i.e. any that matches the regular
136 expression qr/[a-z][a-z_]/i.
137
138 • module($self,$key,$value)
139
140 Validates that a given key is in an acceptable module name format,
141 e.g. 'Test::CPAN::Meta::YAML::Version'.
142
143 • anything($self,$key,$value)
144
145 Usually reserved for user defined structures, allowing them to be
146 considered valid without a need for a specification definition for
147 the structure.
148
150 There are no known bugs at the time of this release. However, if you
151 spot a bug or are experiencing difficulties that are not explained
152 within the POD documentation, please send an email to barbie@cpan.org
153 or submit a bug to the RT system
154 (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-YAML).
155 However, it would help greatly if you are able to pinpoint problems or
156 even supply a patch.
157
158 Fixes are dependent upon their severity and my availability. Should a
159 fix not be forthcoming, please feel free to (politely) remind me.
160
162 Barbie, <barbie@cpan.org> for Miss Barbell Productions,
163 <http://www.missbarbell.co.uk>
164
166 Copyright (C) 2007-2015 Barbie for Miss Barbell Productions
167
168 This distribution is free software; you can redistribute it and/or
169 modify it under the Artistic Licence v2.
170
171
172
173perl v5.32.1 2021-01-27Test::CPAN::Meta::YAML::Version(3)