1Test::CPAN::Meta::VersiUosne(r3)Contributed Perl DocumenTteastti:o:nCPAN::Meta::Version(3)
2
3
4
6 Test::CPAN::Meta::Version - Validate CPAN META data against the
7 specification
8
10 use Test::CPAN::Meta::Version;
11
13 This distribution was written to ensure that a META.yml file, provided
14 with a standard distribution uploaded to CPAN, meets the specifications
15 that are slowly being introduced to module uploads, via the use of
16 package makers and installers such as ExtUtils::MakeMaker,
17 Module::Build and Module::Install.
18
19 This module is meant to be used together with Test::CPAN::Meta, however
20 the code is self contained enough that you can access it directly.
21
22 See CPAN::Meta for further details of the CPAN Meta Specification.
23
25 · new( data => $data [, spec => $version] )
26
27 The constructor must be passed a valid data structure.
28
29 Optionally you may also provide a specification version. This
30 version is then use to ensure that the given data structure meets
31 the respective specification definition. If no version is provided
32 the module will attempt to deduce the appropriate specification
33 version from the data structure itself.
34
36 Main Methods
37 · parse()
38
39 Using the given data structure provided with the constructor,
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 data structure conforms
53 to the appropriate specification definition.
54
55 · check_list($spec,$data)
56
57 Checks whether a list (or array) part of the 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
140 · anything($self,$key,$value)
141
142 Usually reserved for user defined structures, allowing them to be
143 considered valid without a need for a specification definition for
144 the structure.
145
147 There are no known bugs at the time of this release. However, if you
148 spot a bug or are experiencing difficulties that are not explained
149 within the POD documentation, please send an email to barbie@cpan.org
150 or submit a bug to the RT system
151 (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta).
152 However, it would help greatly if you are able to pinpoint problems or
153 even supply a patch.
154
155 Fixes are dependent upon their severity and my availability. Should a
156 fix not be forthcoming, please feel free to (politely) remind me.
157
159 Barbie, <barbie@cpan.org> for Miss Barbell Productions,
160 <http://www.missbarbell.co.uk>
161
163 Copyright (C) 2007-2015 Barbie for Miss Barbell Productions
164
165 This distribution is free software; you can redistribute it and/or
166 modify it under the Artistic Licence v2.
167
168
169
170perl v5.32.0 2020-07-28 Test::CPAN::Meta::Version(3)