1Test::CPAN::Meta::JSON(U3s)er Contributed Perl DocumentatTieosnt::CPAN::Meta::JSON(3)
2
3
4
6 Test::CPAN::Meta::JSON - Validate a META.json file within a CPAN
7 distribution.
8
10 There are two forms this module can be used.
11
12 The first is a standalone test of your distribution's META.json file:
13
14 use Test::More;
15 eval "use Test::CPAN::Meta::JSON";
16 plan skip_all => "Test::CPAN::Meta::JSON required for testing META.json" if $@;
17 meta_json_ok();
18
19 Note that you may provide an optional label/comment/message/etc to the
20 function, or one will be created automatically.
21
22 The second form allows you to test other META.json files, or specify a
23 specific version you wish to test against:
24
25 use Test::More test => 6;
26 use Test::CPAN::Meta::JSON;
27
28 # specify a file and specification version
29 meta_spec_ok('META.json','1.3',$msg);
30
31 # specify the specification version to validate the local META.json
32 meta_spec_ok(undef,'1.3',$msg);
33
34 # specify a file, where the specification version is deduced
35 # from the file itself
36 meta_spec_ok('META.json',undef,$msg);
37
38 Note that this form requires you to specify the number of tests you
39 will be running in your test script. Also note that each 'meta_spec_ok'
40 is actually 2 tests under the hood.
41
42 Also note that the version you are testing against, is the version of
43 the META.yml specification, which forms the basis for the contents of a
44 META.json file.
45
46 <http://www.nntp.perl.org/group/perl.module.build/2008/06/msg1360.html>
47
49 This module was written to ensure that a META.json file, provided with
50 a standard distribution uploaded to CPAN, meets the specifications that
51 are slowly being introduced to module uploads, via the use of package
52 makers and installers such as ExtUtils::MakeMaker, Module::Build and
53 Module::Install.
54
55 See CPAN::Meta for further details of the CPAN Meta Specification.
56
58 A test module to validate a CPAN META.json file.
59
61 · meta_json_ok([$msg])
62
63 Basic META.json wrapper around meta_spec_ok.
64
65 Returns a hash reference to the contents of the parsed META.json
66
67 · meta_spec_ok($file, $version [,$msg])
68
69 Validates the named file against the given specification version.
70 Both $file and $version can be undefined.
71
72 Returns a hash reference to the contents of the given file, after
73 it has been parsed.
74
76 There are currently 3 distributions to test META files:
77
78 Test-CPAN-Meta
79 Test-CPAN-Meta-JSON
80 Test-CPAN-Meta-YAML
81
82 All three have slightly different requirements and are intended to be
83 used in slightly different environments.
84
85 Test-CPAN-Meta-YAML requires a YAML parser, and currently looks for the
86 YAML or YAML::Syck modules. This is the original variant of the 3 and
87 was intended to provide a more complete YAML validation of a META.yml.
88
89 Test-CPAN-Meta requires the Parse::CPAN::Meta module, which is now part
90 of Perl Core as of perl-5.10.1. This version is intended to be used by
91 those only wishing to rely on core modules to test their META.yml
92 files.
93
94 Test-CPAN-Meta-JSON is the most recent addition to the family, and is
95 specifically aimed at those distributions that use a META.json Meta
96 file. The distribution requires the JSON module to parse the Meta file.
97
99 There are no known bugs at the time of this release. However, if you
100 spot a bug or are experiencing difficulties that are not explained
101 within the POD documentation, please send an email to barbie@cpan.org
102 or submit a bug to the RT system
103 (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-JSON).
104 However, it would help greatly if you are able to pinpoint problems or
105 even supply a patch.
106
107 Fixes are dependent upon their severity and my availability. Should a
108 fix not be forthcoming, please feel free to (politely) remind me.
109
111 JSON
112
114 Barbie, <barbie@cpan.org> for Miss Barbell Productions,
115 <http://www.missbarbell.co.uk>
116
118 Copyright (C) 2009-2015 Barbie for Miss Barbell Productions
119
120 This distribution is free software; you can redistribute it and/or
121 modify it under the Artistic Licence v2.
122
123
124
125perl v5.32.0 2020-07-28 Test::CPAN::Meta::JSON(3)