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