Name
PGXN::Meta::Validator - Validate PGXN distribution metadata structures
Synopsis
my $struct = decode_json_file('META.json');
my $pmv = PGXN::Meta::Validator->new( $struct );
unless ( $pmv->is_valid ) {
my $msg = "Invalid META structure. Errors found:\n";
$msg .= join( "\n", $pmv->errors );
die $msg;
}
Description
This module validates a PGXN Meta structure against the version of the the specification claimed in the meta-spec
field of the structure.
Interface
Constructor
new
my $pmv = PGXN::Meta::Validator->new( $struct )
The constructor must be passed a metadata structure.
load_file
my $meta = PGXN::Meta::Validator->load_file('META.json');
Reads in the specified JSON file and passes the resulting data structure to new()
, returning the resulting PGXN::Meta::Validator object. An exception will be thrown if the file does not exist or if its contents are not valid JSON.
Instance Methods
is_valid
if ( $pmv->is_valid ) {
...
}
Returns a boolean value indicating whether the metadata provided is valid.
errors
warn( join "\n", $pmv->errors );
Returns a list of errors seen during validation.
Support
This module is stored in an open GitHub repository. Feel free to fork and contribute!
Please file bug reports via GitHub Issues or by sending mail to bug-PGXN-Meta@rt.cpan.org.