1CPAN::Meta::Converter(3U)ser Contributed Perl DocumentatiCoPnAN::Meta::Converter(3)
2
3
4

NAME

6       CPAN::Meta::Converter - Convert CPAN distribution metadata structures
7

VERSION

9       version 2.120921
10

SYNOPSIS

12         my $struct = decode_json_file('META.json');
13
14         my $cmc = CPAN::Meta::Converter->new( $struct );
15
16         my $new_struct = $cmc->convert( version => "2" );
17

DESCRIPTION

19       This module converts CPAN Meta structures from one form to another.
20       The primary use is to convert older structures to the most modern
21       version of the specification, but other transformations may be
22       implemented in the future as needed.  (E.g. stripping all custom fields
23       or stripping all optional fields.)
24

METHODS

26   new
27         my $cmc = CPAN::Meta::Converter->new( $struct );
28
29       The constructor should be passed a valid metadata structure but invalid
30       structures are accepted.  If no meta-spec version is provided, version
31       1.0 will be assumed.
32
33   convert
34         my $new_struct = $cmc->convert( version => "2" );
35
36       Returns a new hash reference with the metadata converted to a different
37       form.  "convert" will die if any conversion/standardization still
38       results in an invalid structure.
39
40       Valid parameters include:
41
42       ·   "version" -- Indicates the desired specification version (e.g.
43           "1.0", "1.1" ... "1.4", "2").  Defaults to the latest version of
44           the CPAN Meta Spec.
45
46       Conversion proceeds through each version in turn.  For example, a
47       version 1.2 structure might be converted to 1.3 then 1.4 then finally
48       to version 2. The conversion process attempts to clean-up simple errors
49       and standardize data.  For example, if "author" is given as a scalar,
50       it will converted to an array reference containing the item.
51       (Converting a structure to its own version will also clean-up and
52       standardize.)
53
54       When data are cleaned and standardized, missing or invalid fields will
55       be replaced with sensible defaults when possible.  This may be lossy or
56       imprecise.  For example, some badly structured META.yml files on CPAN
57       have prerequisite modules listed as both keys and values:
58
59         requires => { 'Foo::Bar' => 'Bam::Baz' }
60
61       These would be split and each converted to a prerequisite with a
62       minimum version of zero.
63
64       When some mandatory fields are missing or invalid, the conversion will
65       attempt to provide a sensible default or will fill them with a value of
66       'unknown'.  For example a missing or unrecognized "license" field will
67       result in a "license" field of 'unknown'.  Fields that may get an
68       'unknown' include:
69
70       ·   abstract
71
72       ·   author
73
74       ·   license
75

BUGS

77       Please report any bugs or feature using the CPAN Request Tracker.  Bugs
78       can be submitted through the web interface at
79       <http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta>
80
81       When submitting a bug or request, please include a test-file or a patch
82       to an existing test-file that illustrates the bug or desired feature.
83

AUTHORS

85       ·   David Golden <dagolden@cpan.org>
86
87       ·   Ricardo Signes <rjbs@cpan.org>
88
90       This software is copyright (c) 2010 by David Golden and Ricardo Signes.
91
92       This is free software; you can redistribute it and/or modify it under
93       the same terms as the Perl 5 programming language system itself.
94
95
96
97perl v5.16.3                      2012-04-01          CPAN::Meta::Converter(3)
Impressum