Test::...Version(3pm)

πŸ“¦
version 0.25 Β· 5 versions
, in debian bookworm, debian trixie, ubuntu noble, ubuntu resolute, ubuntu stonking

πŸ’– Test::CPAN::Meta::YAML::Version πŸ’–

okay bestie, so this is a <pink>User Contributed Perl Documentation</pink> page, section 3pm, for a lil module called Test::CPAN::Meta::YAML::Version. it's giving quality control for your CPAN metadata. let's get into it 🫢


✨ NAME ✨

Test::CPAN::Meta::YAML::Version β€” Validate CPAN META data against the specification πŸ’…


🌸 SYNOPSIS 🌸

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

that's it. that's the whole vibe. no cap.


πŸ¦‹ DESCRIPTION πŸ¦‹

so this module was written to make sure that a META.yml file β€” the one that ships with a standard distribution uploaded to CPAN β€” actually meets the specifications that are, and I quote, slowly being introduced to module uploads. the way they get introduced? via ExtUtils::MakeMaker, Module::Build and Module::Install. it's a whole ecosystem, iykyk.

this module is meant to be used together with Test::CPAN::Meta::YAML, but honestly the code is self contained enough that you can access it directly. independent queen πŸ‘‘

also, go peek at CPAN::Meta if you want further details of the CPAN Meta Specification. it's the main character of spec docs fr fr.


πŸŽ€ ABSTRACT πŸŽ€

Validation of META.yml data against the CPAN Meta Specification. short, sweet, iconic.


πŸ‘‘ CLASS CONSTRUCTOR πŸ‘‘

  • new( data => $data [, spec => $version] ) β€” the constructor, the birth of your object, literally.

you must pass it a valid data structure. no data structure, no object, periodt.

optionally you may also provide a specification version. that version then gets used to make sure the given data structure meets the respective specification definition. and if you don't provide a version? the module will attempt to deduce the appropriate specification version from the data structure itself. she's self-sufficient like that πŸ’…


🌈 METHODS 🌈

πŸ’« Main Methods πŸ’«

  • parse() β€” using the given data structure that you passed to the constructor, it attempts to parse and validate according to the appropriate specification definition.

returns 1 if any errors are found, otherwise returns 0. yes bestie, it's inverted from what you'd expect β€” 1 means bad, 0 means good. iconic of her honestly.

  • errors() β€” returns a list of the errors found during parsing. receipts, basically πŸ“

πŸ”₯ 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. she's retired, but we still love her 🫢
  • 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. no mystery links allowed πŸ”—
  • string_or_undef($self,$key,$value) β€” validates that the value is either a string or an undef value. 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) β€” validate 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'. a whole little crowd of versions.
  • 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. versatile queen ✨
  • boolean($self,$key,$value) β€” validates for a boolean value. currently these values are '1', '0', 'true', 'false', however the latter 2 may be removed.
  • 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. two different flavours of valid, love that for her.
  • 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. glow-up behavior πŸ“ˆ

  • 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::YAML::Version'. she's checking for her own name, meta much? πŸ’€
  • 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. it literally accepts anything. no rules, just vibes 🌈

πŸ’€ 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 at http://rt.cpan.org/Public/Dist/Display.html?Name=Test-CPAN-Meta-YAML. however, it would help greatly if you are able to pinpoint problems or even supply a patch. do the work bestie, it's appreciated πŸ™

fixes are dependent upon their severity and my availability. should a fix not be forthcoming, please feel free to (politely) remind me. politely is doing a lot of heavy lifting in that sentence, note that πŸ’…


πŸ’œ 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.

and that's the whole page, bestie! πŸŽ€ this one came from perl v5.34.0, dated 2022-06-17 β€” so if you're reading it in the future, hi from the past, she still slays. bye babes πŸ’–βœ¨