Test::C...:Version(3)

🌸 NAME 🌸

Okay bestie, welcome to the User Contributed Perl Documentation page for Test::CPAN::Meta::Version β€” its whole entire thing is to Validate CPAN META data against the specification. I'm highkey obsessed with how specific that is. Periodt.

✨ SYNOPSIS ✨

use Test::CPAN::Meta::Version;

πŸ¦‹ DESCRIPTION πŸ¦‹

So this distribution was written to make sure 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 package makers and installers like ExtUtils::MakeMaker, Module::Build, and Module::Install. This distribution ate and left no crumbs.

This module is meant to be used together with Test::CPAN::Meta, but ngl the code is self-contained enough that you can access it directly. Main character energy, no cap.

Wanna know more about the CPAN Meta Specification? See CPAN::Meta for further details. Iykyk.

πŸŽ€ CLASS CONSTRUCTOR πŸŽ€

  • new( data => $data [, spec => $version] ) β€” okay so the constructor must be passed a valid data structure. You can optionally also provide a specification version, and that version is then used to ensure that the given data structure meets the respective specification definition. If no version is provided, the module will attempt to deduce the appropriate specification version from the data structure itself. Slay.

πŸ’… METHODS πŸ’…

🌟 Main Methods 🌟

  • parse() β€” using the given data structure provided with the constructor, this attempts to parse and validate according to the appropriate specification definition. Returns 1 if any errors are found, otherwise returns 0. Vibe check passed or failed, basically.
  • errors() β€” returns a list of the errors found during parsing. The receipts, bestie.

🧚 Check Methods 🧚

  • check_map($spec,$data) β€” checks whether a map (or hash) part of the data structure conforms to the appropriate specification definition.
  • check_list($spec,$data) β€” checks whether a list (or array) part of the data structure conforms to the appropriate specification definition.

πŸ” Validator Methods πŸ”

  • header($self,$key,$value) β€” validates that the YAML header is valid. Note: no longer used as we now read the YAML data structure, not the file. Throwback, but she's retired.
  • url($self,$key,$value) β€” validates that a given value is in an acceptable URL format.
  • urlspec($self,$key,$value) β€” validates that the URL to a META.yml specification is a known one.
  • string_or_undef($self,$key,$value) β€” validates that the value is either a string or an undef value. It's a bit of a catchall function for parts of the data structure that are completely user defined.
  • string($self,$key,$value) β€” validates that a string exists for the given key.
  • file($self,$key,$value) β€” validates that a file is passed for the given key. This may be made more thorough in the future. For now it acts like \&string.
  • exversion($self,$key,$value) β€” validates a list of versions, e.g. '<= 5, >=2, ==3, !=4, >1, <6, 0'.
  • version($self,$key,$value) β€” validates a single version string. Versions of the type '5.8.8' and '0.00_00' are both valid. A leading 'v' like 'v1.2.3' is also valid.
  • boolean($self,$key,$value) β€” validates for a boolean value. Currently these values are '1', '0', 'true', 'false', however the latter 2 may be removed. Sad, but noted.
  • license($self,$key,$value) β€” validates that a value is given for the license. Returns 1 if a known license type, or 2 if a value is given but the license type is not a recommended one.
  • resource($self,$key,$value) β€” validates that the given key is in CamelCase, to indicate a user defined keyword.
  • keyword($self,$key,$value) β€” validates that key is in an acceptable format for the META.yml specification, i.e. any in the character class [-_a-z]. For user defined keys, although not explicitly stated in the specifications (v1.0 - v1.4), the convention is to precede the key with a pattern matching qr{\Ax_}i. Following this any character from the character class [-_a-zA-Z] can be used. This clarification has been added to v2.0 of the specification. History lesson, but make it fashion.
  • identifier($self,$key,$value) β€” validates that key is in an acceptable format for the META.yml specification, for an identifier, i.e. any that matches the regular expression qr/[a-z][a-z_]/i.
  • module($self,$key,$value) β€” validates that a given key is in an acceptable module name format, e.g. 'Test::CPAN::Meta::Version'.
  • anything($self,$key,$value) β€” usually reserved for user defined structures, allowing them to be considered valid without a need for a specification definition for the structure. Not me loving a validator that lowkey says β€œsure, whatever.” πŸ’€

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

There are no known bugs at the time of this release. 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. Fr fr, that would be a slay.

Fixes are dependent upon their severity and my availability. Should a fix not be forthcoming, please feel free to (politely) remind me. Key word: politely. πŸ’…

πŸ‘‘ AUTHOR πŸ‘‘

Barbie, <barbie@cpan.org> for Miss Barbell Productions, <http://www.missbarbell.co.uk>. Author icon, honestly.

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.


xoxo, your girl signing off β€” this page was Test::C...:Version(3), from User Contributed Perl Documentation, built with perl v5.42.0, dated 2019-11-30. Bye bestie! πŸ«ΆπŸ’–

πŸ“¦ where this page comes from