CPAN::Meta::Validator(3perl) Perl Programmers Reference Guide CPAN::Meta::Validator(3perl)

CPAN::Meta::Validator - validate CPAN distribution metadata structures

version 2.150010

my $struct = decode_json_file('META.json');

my $cmv = CPAN::Meta::Validator->new( $struct );

unless ( $cmv->is_valid ) {
  my $msg = "Invalid META structure.  Errors found:\n";
  $msg .= join( "\n", $cmv->errors );
  die $msg;
}

This module validates a CPAN Meta structure against the version of the the specification claimed in the "meta-spec" field of the structure.

my $cmv = CPAN::Meta::Validator->new( $struct )

The constructor must be passed a metadata structure.

if ( $cmv->is_valid ) {
  ...
}

Returns a boolean value indicating whether the metadata provided is valid.

warn( join "\n", $cmv->errors );

Returns a list of errors seen during validation.

Please report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through the web interface at http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta

When submitting a bug or request, please include a test-file or a patch to an existing test-file that illustrates the bug or desired feature.

  • David Golden <dagolden@cpan.org>
  • Ricardo Signes <rjbs@cpan.org>
  • Adam Kennedy <adamk@cpan.org>

This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

2021-05-23 perl v5.34.0