Data::Schema::Schema::CPANMeta - Schema for CPAN Meta
version 0.09
# you can use it in test script a la Test::CPAN::Meta use Test::More; use Data::Schema::Schema::CPANMeta qw(meta_yaml_ok); meta_yaml_ok(); # test META.json instead of META.yml use Test::More; use Data::Schema::Schema::CPANMeta qw(meta_json_ok); meta_json_ok(); # slightly longer example use Test::More tests => ...; use Data::Schema::Schema::CPANMeta qw(meta_spec_ok); meta_spec_ok("META.yml", 1.4, "Bad META.yml!"); # JSON version use Test::More tests => ...; use Data::Schema::Schema::CPANMeta qw(meta_spec_ok); meta_spec_ok("META.json", 2, "Bad META.json!"); # using outside test script use Data::Schema qw(Schema::CPANMeta); use YAML; use File::Slurp; my $meta = Load(scalar read_file "META.yml"); my $res = ds_validate($meta, 'cpan_meta_2'); # to get the schema as YAML string use Data::Schema::Schema::CPANMeta qw($yaml_schema_2 $yaml_schema_14);
This module contains the schema for CPAN META.yml specification version 1.4 and 2, in Data::Schema language. If you import $yaml_schema_14 and $yaml_schema_2 (or browse the source of this module), you can find the schema written as YAML.
$yaml_schema_14
$yaml_schema_2
You can use the schema to validate META.yml or META.json files.
Basic META.yml wrapper around meta_spec_ok.
Returns a hash reference to the contents of the parsed META.yml
Basic META.json wrapper around meta_spec_ok.
Returns a hash reference to the contents of the parsed META.json
Validates the named file against the given specification version. Both $file and $version can be undefined.
Returns a hash reference to the contents of the given file, after it has been parsed.
Note that unlike with meta_yaml_ok() or meta_json_ok(), this form requires you to specify the number of tests you will be running in your test script (or use done_testing()). Also note that each meta_spec_ok() is actually 2 tests under the hood.
meta_yaml_ok()
meta_json_ok()
done_testing()
meta_spec_ok()
Data::Schema
Module::Build
Test::CPAN::Meta
CPAN META 1.4 specification document, http://module-build.sourceforge.net/META-spec-v1.4.html
CPAN META 2 specification document, CPAN::Meta::Spec
Steven Haryanto <stevenharyanto@gmail.com>
This software is copyright (c) 2010 by Steven Haryanto.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.
To install Data::Schema::Schema::CPANMeta, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Data::Schema::Schema::CPANMeta
CPAN shell
perl -MCPAN -e shell install Data::Schema::Schema::CPANMeta
For more information on module installation, please visit the detailed CPAN module installation guide.