CPAN::Meta::Converter - Convert CPAN distribution metadata structures
my $struct = decode_json_file('META.json'); my $cmc = CPAN::Meta::Converter->new( $struct ); my $new_struct = $cmc->convert( version => "2" );
This module converts CPAN Meta structures from one form to another. The primary use is to convert older structures to the most modern version of the specification, but other transformations may be implemented in the future as needed. (E.g. stripping all custom fields or stripping all optional fields.)
my $cmc = CPAN::Meta::Converter->new( $struct );
The constructor should be passed a valid metadata structure but invalid structures are accepted. If no meta-spec version is provided, version 1.0 will be assumed.
my $new_struct = $cmc->convert( version => "2" );
Returns a new hash reference with the metadata converted to a different form.
Valid parameters include:
Indicates the desired specification version (e.g. "1.0", "1.1" ... "1.4", "2"). Converting a structure to its own version will just return a copy of the structure. Defaults to the latest version of the CPAN Meta Spec.
The conversion process attempts to clean-up and standardize data during converstion. For example, if
author is given as a scalar, it will converted to an array reference containing the item.
Conversion proceeds through each version in turn. For example, a version 1.2 structure is converted to 1.3 then 1.4 then finally version 2.
convert will die if any conversion results in an invalid structure.
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 <email@example.com> Ricardo Signes <firstname.lastname@example.org>
COPYRIGHT AND LICENSE
This software is copyright (c) 2010 by David Golden and Ricardo Signes.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.