{
    "content": [
        {
            "type": "text",
            "text": "# CPAN::Meta::Converter (perldoc)\n\n**Summary:** CPAN::Meta::Converter - Convert CPAN distribution metadata structures\n\n**Synopsis:** my $struct = decodejsonfile('META.json');\nmy $cmc = CPAN::Meta::Converter->new( $struct );\nmy $newstruct = $cmc->convert( version => \"2\" );\n\n## Section Outline\n\n- **NAME** (2 lines)\n- **VERSION** (2 lines)\n- **SYNOPSIS** (6 lines)\n- **DESCRIPTION** (5 lines)\n- **METHODS** (58 lines)\n- **BUGS** (6 lines)\n- **AUTHORS** (6 lines)\n- **COPYRIGHT AND LICENSE** (6 lines)\n\n## Full Content\n\n### NAME\n\nCPAN::Meta::Converter - Convert CPAN distribution metadata structures\n\n### VERSION\n\nversion 2.150010\n\n### SYNOPSIS\n\nmy $struct = decodejsonfile('META.json');\n\nmy $cmc = CPAN::Meta::Converter->new( $struct );\n\nmy $newstruct = $cmc->convert( version => \"2\" );\n\n### DESCRIPTION\n\nThis module converts CPAN Meta structures from one form to another. The primary use is to\nconvert older structures to the most modern version of the specification, but other\ntransformations may be implemented in the future as needed. (E.g. stripping all custom fields or\nstripping all optional fields.)\n\n### METHODS\n\nnew\nmy $cmc = CPAN::Meta::Converter->new( $struct );\n\nThe constructor should be passed a valid metadata structure but invalid structures are accepted.\nIf no meta-spec version is provided, version 1.0 will be assumed.\n\nOptionally, you can provide a \"defaultversion\" argument after $struct:\n\nmy $cmc = CPAN::Meta::Converter->new( $struct, defaultversion => \"1.4\" );\n\nThis is only needed when converting a metadata fragment that does not include a \"meta-spec\"\nfield.\n\nconvert\nmy $newstruct = $cmc->convert( version => \"2\" );\n\nReturns a new hash reference with the metadata converted to a different form. \"convert\" will die\nif any conversion/standardization still results in an invalid structure.\n\nValid parameters include:\n\n*   \"version\" -- Indicates the desired specification version (e.g. \"1.0\", \"1.1\" ... \"1.4\", \"2\").\nDefaults to the latest version of the CPAN Meta Spec.\n\nConversion proceeds through each version in turn. For example, a version 1.2 structure might be\nconverted to 1.3 then 1.4 then finally to version 2. The conversion process attempts to clean-up\nsimple errors and standardize data. For example, if \"author\" is given as a scalar, it will\nconverted to an array reference containing the item. (Converting a structure to its own version\nwill also clean-up and standardize.)\n\nWhen data are cleaned and standardized, missing or invalid fields will be replaced with sensible\ndefaults when possible. This may be lossy or imprecise. For example, some badly structured\nMETA.yml files on CPAN have prerequisite modules listed as both keys and values:\n\nrequires => { 'Foo::Bar' => 'Bam::Baz' }\n\nThese would be split and each converted to a prerequisite with a minimum version of zero.\n\nWhen some mandatory fields are missing or invalid, the conversion will attempt to provide a\nsensible default or will fill them with a value of 'unknown'. For example a missing or\nunrecognized \"license\" field will result in a \"license\" field of 'unknown'. Fields that may get\nan 'unknown' include:\n\n*   abstract\n\n*   author\n\n*   license\n\nupgradefragment\nmy $newstruct = $cmc->upgradefragment;\n\nReturns a new hash reference with the metadata converted to the latest version of the CPAN Meta\nSpec. No validation is done on the result -- you must validate after merging fragments into a\ncomplete metadata document.\n\nAvailable since version 2.141170.\n\n### BUGS\n\nPlease report any bugs or feature using the CPAN Request Tracker. Bugs can be submitted through\nthe web interface at <http://rt.cpan.org/Dist/Display.html?Queue=CPAN-Meta>\n\nWhen submitting a bug or request, please include a test-file or a patch to an existing test-file\nthat illustrates the bug or desired feature.\n\n### AUTHORS\n\n*   David Golden <dagolden@cpan.org>\n\n*   Ricardo Signes <rjbs@cpan.org>\n\n*   Adam Kennedy <adamk@cpan.org>\n\n### COPYRIGHT AND LICENSE\n\nThis software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and\nContributors.\n\nThis is free software; you can redistribute it and/or modify it under the same terms as the Perl\n5 programming language system itself.\n\n"
        }
    ],
    "structuredContent": {
        "command": "CPAN::Meta::Converter",
        "section": "",
        "mode": "perldoc",
        "summary": "CPAN::Meta::Converter - Convert CPAN distribution metadata structures",
        "synopsis": "my $struct = decodejsonfile('META.json');\nmy $cmc = CPAN::Meta::Converter->new( $struct );\nmy $newstruct = $cmc->convert( version => \"2\" );",
        "tldr_summary": null,
        "tldr_examples": [],
        "tldr_source": null,
        "flags": [],
        "examples": [],
        "see_also": [],
        "section_outline": [
            {
                "name": "NAME",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "VERSION",
                "lines": 2,
                "subsections": []
            },
            {
                "name": "SYNOPSIS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "DESCRIPTION",
                "lines": 5,
                "subsections": []
            },
            {
                "name": "METHODS",
                "lines": 58,
                "subsections": []
            },
            {
                "name": "BUGS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "AUTHORS",
                "lines": 6,
                "subsections": []
            },
            {
                "name": "COPYRIGHT AND LICENSE",
                "lines": 6,
                "subsections": []
            }
        ]
    }
}