CPAN::META::MERGE(3perl)

πŸ’– CPAN::Meta::Merge β€” Merging CPAN Meta fragments πŸ’–

okay bestie, listen. this is CPAN::Meta::Merge, a little Perl module from the Perl Programmers Reference Guide, and it does exactly one thing but it does it so well: it takes a bunch of CPAN Meta fragments and smushes them together into one. no cap. πŸ¦‹

✨ VERSION ✨

version 2.150013 β€” that's the one, periodt.


🌸 SYNOPSIS 🌸

my $merger = CPAN::Meta::Merge->new(default_version => "2");
my $meta = $merger->merge($base, @additional);

like… three lines. that's the whole vibe. make a merger, feed it fragments, get meta back. iconic. πŸ‘‘


πŸŽ€ DESCRIPTION πŸŽ€

bestie there is literally nothing here in the original. the DESCRIPTION section is empty. it's giving minimalist. it's giving "the code speaks for itself." so we move. πŸ’…


πŸ’… METHODS πŸ’…

🌈 new

This creates a CPAN::Meta::Merge object. It takes one mandatory named argument, version, declaring the version of the meta-spec that must be used for the merge. It can optionally take an extra_mappings argument that lets you add additional merging functions for specific elements. πŸ”₯

The extra_mappings argument takes a hash ref with the same type of structure as described in CPAN::Meta::Spec, except its values are one of the defined merge strategies or a code ref to a merging function. iykyk.

my $merger = CPAN::Meta::Merge->new(
    default_version => '2',
    extra_mappings => {
        'optional_features' => \&custom_merge_function,
        'x_custom' => 'set_addition',
        'x_meta_meta' => {
            name => 'identical',
            tags => 'set_addition',
        }
    }
);
lowkey notice how the example says default_version while the prose says version? yeah. we're just reporting the facts, bestie, exactly as they were written. πŸ™ˆ

🧚 merge(@fragments)

Merge all @fragments together. It will accept both CPAN::Meta objects and (possibly incomplete) hashrefs of metadata. mix and match, it doesn't care. 🫢


⭐ MERGE STRATEGIES ⭐

merge uses various strategies to combine different elements of the CPAN::Meta objects. The following strategies can be used with the extra_mappings argument of new:

  • identical β€” The elements must be identical. that's it. no wiggle room, no negotiating. if they're not the same it's not happening. πŸ’€
  • set_addition β€” The union of two array refs. math but make it makeup:
[ a, b ] U [ a, c]  = [ a, b, c ]
  • uniq_map β€” Key value pairs from the right hash are merged to the left hash. Key collisions are only allowed if their values are the same. This merge function will recurse into nested hash refs following the same merge rules. it goes deep. 🌊
  • improvise β€” This merge strategy will try to pick the appropriate predefined strategy based on what element type. Array refs will try to use the set_addition strategy, Hash refs will try to use the uniq_map strategy, and everything else will try the identical strategy. it's the main character that adapts to the room. ✨

🌸 AUTHORS 🌸

  • David Golden <dagolden@cpan.org>
  • Ricardo Signes <cpan@semiotic.systems>
  • Adam Kennedy <adamk@cpan.org>

the legends. the blueprint. we stan. πŸŽ€


This software is copyright (c) 2010 by David Golden, Ricardo Signes, Adam Kennedy and Contributors.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. free as in ✨free✨, bestie.


and that's the page!! this was CPAN::Meta::Merge from perl v5.44.0, dated 2026-10-17. go merge something gorgeous. mwah. πŸ’…πŸ’–

πŸ“¦ where this page comes from
  • arch rolling: perl 5.44.0-1 Β· Artistic-1.0-Perl AND GPL-1.0-or-later
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms