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 saysdefault_versionwhile the prose saysversion? 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 theset_additionstrategy, Hash refs will try to use theuniq_mapstrategy, and everything else will try theidenticalstrategy. 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. π
π COPYRIGHT AND LICENSE π
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