{
    "mode": "perldoc",
    "parameter": "CPAN::Meta::Merge",
    "section": "",
    "url": "https://www.chedong.com/phpMan.php/perldoc/CPAN%3A%3AMeta%3A%3AMerge/json",
    "generated": "2026-06-03T10:12:28Z",
    "synopsis": "my $merger = CPAN::Meta::Merge->new(defaultversion => \"2\");\nmy $meta = $merger->merge($base, @additional);",
    "sections": {
        "NAME": {
            "content": "CPAN::Meta::Merge - Merging CPAN Meta fragments\n",
            "subsections": []
        },
        "VERSION": {
            "content": "version 2.150010\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "my $merger = CPAN::Meta::Merge->new(defaultversion => \"2\");\nmy $meta = $merger->merge($base, @additional);\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "",
            "subsections": []
        },
        "METHODS": {
            "content": "new\nThis creates a CPAN::Meta::Merge object. It takes one mandatory named argument, \"version\",\ndeclaring the version of the meta-spec that must be used for the merge. It can optionally take\nan \"extramappings\" argument that allows one to add additional merging functions for specific\nelements.\n\nThe \"extramappings\" arguments takes a hash ref with the same type of structure as described in\nCPAN::Meta::Spec, except with its values as one of the defined merge strategies or a code ref to\na merging function.\n\nmy $merger = CPAN::Meta::Merge->new(\ndefaultversion => '2',\nextramappings => {\n'optionalfeatures' => \\&custommergefunction,\n'xcustom' => 'setaddition',\n'xmetameta' => {\nname => 'identical',\ntags => 'setaddition',\n}\n}\n);\n\nmerge(@fragments)\nMerge all @fragments together. It will accept both CPAN::Meta objects and (possibly incomplete)\nhashrefs of metadata.\n",
            "subsections": []
        },
        "MERGE STRATEGIES": {
            "content": "\"merge\" uses various strategies to combine different elements of the CPAN::Meta objects. The\nfollowing strategies can be used with the extramappings argument of \"new\":\n\nidentical\nThe elements must be identical\n\nsetaddition\nThe union of two array refs\n\n[ a, b ] U [ a, c]  = [ a, b, c ]\n\nuniqmap\nKey value pairs from the right hash are merged to the left hash. Key collisions are only\nallowed if their values are the same. This merge function will recurse into nested hash refs\nfollowing the same merge rules.\n\nimprovise\nThis merge strategy will try to pick the appropriate predefined strategy based on what\nelement type. Array refs will try to use the \"setaddition\" strategy, Hash refs will try to\nuse the \"uniqmap\" strategy, and everything else will try the \"identical\" strategy.\n",
            "subsections": []
        },
        "AUTHORS": {
            "content": "*   David Golden <dagolden@cpan.org>\n\n*   Ricardo Signes <rjbs@cpan.org>\n\n*   Adam Kennedy <adamk@cpan.org>\n",
            "subsections": []
        },
        "COPYRIGHT AND LICENSE": {
            "content": "This 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",
            "subsections": []
        }
    },
    "summary": "CPAN::Meta::Merge - Merging CPAN Meta fragments",
    "flags": [],
    "examples": [],
    "see_also": []
}