1Test::CPAN::Meta::VersiUosne(r3)Contributed Perl DocumenTteastti:o:nCPAN::Meta::Version(3)
2
3
4
6 Test::CPAN::Meta::Version - Validation of META.yml specification
7 elements.
8
10 use Test::CPAN::Meta::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, however
19 the code is self contained enough that you can access it directly.
20
22 Validation of META.yml specification elements.
23
25 · new( yaml => $yaml [, spec => $version] )
26
27 The constructor must be passed a valid YAML data structure.
28
29 Optionally you may also provide a specification version. This
30 version is then use to ensure that the given YAML data structure
31 meets the respective specification definition. If no version is
32 provided the module will attempt to deduce the appropriate
33 specification version from the data structure itself.
34
36 Main Methods
37 · parse()
38
39 Using the YAML data structure provided with the constructure,
40 attempts to parse and validate according to the appropriate
41 specification definition.
42
43 Returns 1 if any errors found, otherwise returns 0.
44
45 · errors()
46
47 Returns a list of the errors found during parsing.
48
49 Check Methods
50 · check_map($spec,$data)
51
52 Checks whether a map (or hash) part of the YAML data structure
53 conforms to the appropriate specification definition.
54
55 · check_list($spec,$data)
56
57 Checks whether a list (or array) part of the YAML data structure
58 conforms to the appropriate specification definition.
59
60 Validator Methods
61 · header($self,$key,$value)
62
63 Validates that the YAML header is valid.
64
65 Note: No longer used as we now read the YAML data structure, not
66 the file.
67
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::Version'.
139
141 There are no known bugs at the time of this release. However, if you
142 spot a bug or are experiencing difficulties that are not explained
143 within the POD documentation, please send an email to barbie@cpan.org
144 or submit a bug to the RT system
145 (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta).
146 However, it would help greatly if you are able to pinpoint problems or
147 even supply a patch.
148
149 Fixes are dependant upon their severity and my availablity. Should a
150 fix not be forthcoming, please feel free to (politely) remind me.
151
153 b - Beta testing
154 d - Developer
155 p - Perl-only
156 O - Object oriented
157 p - Standard-Perl: user may choose between GPL and Artistic
158
160 Barbie, <barbie@cpan.org> for Miss Barbell Productions,
161 <http://www.missbarbell.co.uk>
162
164 Copyright (C) 2007-2010 Barbie for Miss Barbell Productions
165
166 This module is free software; you can redistribute it and/or
167 modify it under the same terms as Perl itself.
168
169
170
171perl v5.12.1 2010-04-13 Test::CPAN::Meta::Version(3)