Test::CPAN::Meta(3)

πŸ¦‹ Test::CPAN::Meta(3) β€” the vibe check for your META.yml πŸ¦‹

okay bestie, so this is a page from the User Contributed Perl Documentation and it's literally all about Test::CPAN::Meta β€” the module that makes sure your META.yml files are not a mess. pull up a chair, we're doing this πŸ’…


✨ NAME ✨

Test::CPAN::Meta β€” validate your META.yml files. that's it, that's the whole job, and it slays at it πŸŽ€


🌸 SYNOPSIS 🌸

so there are, like, two forms this module can be used in. two vibes. pick your fighter 🫢

Form one β€” the standalone test of your distribution's META.yml file:

use Test::More;
eval "use Test::CPAN::Meta";
plan skip_all => "Test::CPAN::Meta required for testing META.yml" if $@;
meta_yaml_ok();

quick note, bestie: you may provide an optional label/comment/message/etc to the function, or one will be created automatically for you. either way works, no stress πŸ’–

Form two β€” this one lets you test other META.yml files, or specify a specific version you wanna test against:

use Test::More tests => 6;
use Test::CPAN::Meta;

# specify a file and specification version
meta_spec_ok('META.yml','1.3',$msg);

# specify the specification version to validate the local META.yml
meta_spec_ok(undef,'1.3',$msg);

# specify a file, where the specification version is deduced
# from the file itself
meta_spec_ok('META.yml',undef,$msg);
⚠️ heads up: this form requires you to specify the number of tests you'll be running in your test script. also, plot twist β€” each meta_spec_ok is actually 2 tests under the hood. math is math 😭

πŸ’œ DESCRIPTION πŸ’œ

this distribution was written to ensure that a META.yml file β€” the one provided with a standard distribution uploaded to CPAN β€” actually meets the specifications that are slowly being introduced to module uploads, via the use of package makers and installers such as ExtUtils::MakeMaker, Module::Build and Module::Install. iconic behavior honestly πŸ‘‘

see CPAN::Meta for further details of the CPAN Meta Specification. iykyk πŸ“š


πŸ”₯ FUNCTIONS πŸ”₯

  • meta_yaml_ok([$msg]) β€” the basic META.yml wrapper around meta_spec_ok. returns a hash reference to the contents of the parsed META.yml. simple, clean, does what it says 🧚
  • meta_spec_ok($file, $version [,$msg]) β€” validates the named file against the given specification version. plot twist: both $file and $version can be undefined πŸ‘€. returns a hash reference to the contents of the given file, after it has been parsed. so you get your data back, parsed and ready πŸ’…

🌈 TESTING META FILES 🌈

there are currently 3 distributions to test META files:

Test-CPAN-Meta
Test-CPAN-Meta-JSON
Test-CPAN-Meta-YAML

all three have slightly different requirements and are intended to be used in slightly different environments. like siblings. same family, different lore 🌸

  • Test-CPAN-Meta-YAML requires a YAML parser, and currently looks for the YAML or YAML::Syck modules. this is the original variant of the 3 and was intended to provide a more complete YAML validation of a META.yml. the OG, fr fr ✨
  • Test-CPAN-Meta requires the Parse::CPAN::Meta module, which is now part of Perl Core as of perl-5.10.1. this version is intended to be used by those only wishing to rely on core modules to test their META.yml files. lowkey the minimal-effort icon πŸŽ€
  • Test-CPAN-Meta-JSON is the most recent addition to the family, and is specifically aimed at those distributions that use a META.json Meta file. the distribution requires the JSON module to parse the Meta file. newest sibling, main character energy πŸ‘‘

πŸ’€ BUGS, PATCHES & FIXES πŸ’€

there are no known bugs at the time of this release. slay πŸ’…

however β€” if you spot a bug or are experiencing difficulties that are not explained within the POD documentation, please send an email to barbie@cpan.org or submit a bug to the RT system (http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta).

however, it would help greatly if you are able to pinpoint problems or even supply a patch. like, hugely. bestie behavior 🫢

fixes are dependent upon their severity and my availability. should a fix not be forthcoming, please feel free to (politely) remind me. emphasis on politely, we're not doing that here πŸ™ˆ


πŸ“ SEE ALSO πŸ“

Test::YAML::Valid

πŸ‘‘ AUTHOR πŸ‘‘

Barbie, <barbie@cpan.org> for Miss Barbell Productions, <http://www.missbarbell.co.uk> πŸ’–


Copyright (C) 2007-2015 Barbie for Miss Barbell Productions

This distribution is free software; you can redistribute it and/or
modify it under the Artistic Licence v2.

okay and that's the whole page, no cap πŸŽ€ tiny sign-off: this beauty is perl v5.42.0, dated 2019-11-30, and it's the Test::CPAN::Meta(3) manpage. go forth and validate those YAMLs, bestie. you're gonna ate πŸ’…βœ¨

πŸ“¦ where this page comes from