Dist::...Custom(3pm)
π Dist::...Custom(3pm) β aka Dist::Zilla::Plugin::MakeMaker::Custom π
okay so bestie, welcome to the Dist::...Custom(3pm) page (user contributed Perl documentation, iykyk) β this is the one where you get to write your own Makefile.PL and let Dist::Zilla sprinkle its little template magic on top. it's giving β¨artisanal build filesβ¨ and honestly? iconic.
πΈ NAME πΈ
Dist::Zilla::Plugin::MakeMaker::Custom β the plugin that lets a dist have a custom Makefile.PL, fr fr π
π VERSION π
This document describes version 4.26 of Dist::Zilla::Plugin::MakeMaker::Custom, released December 17, 2017 as part of Dist-Zilla-Plugins-CJM version 6.000. she's a grown woman, respect her π«Ά
β¨ SYNOPSIS β¨
So in dist.ini you'd be like:
[MakeMaker::Custom]
eumm_version = 0.34 ; the default comes from the MakeMaker plugin
And in your Makefile.PL:
use ExtUtils::MakeMaker;
##{ $share_dir_code{preamble} || '' ##}
my %args = (
NAME => "My::Module",
##{ $plugin->get_default(qw(ABSTRACT AUTHOR LICENSE VERSION)) ##}
##{ $plugin->get_prereqs(1) ##}
);
unless ( eval { ExtUtils::MakeMaker->VERSION(6.63_03) } ) {
my $tr = delete $args{TEST_REQUIRES};
my $br = $args{BUILD_REQUIRES};
for my $mod ( keys %$tr ) {
if ( exists $br->{$mod} ) {
$br->{$mod} = $tr->{$mod} if $tr->{$mod} > $br->{$mod};
}
else {
$br->{$mod} = $tr->{$mod};
}
}
} # end unless ExtUtils::MakeMaker is 6.63_03 or newer
unless ( eval { ExtUtils::MakeMaker->VERSION(6.56) } ) {
my $br = delete $args{BUILD_REQUIRES};
my $pp = $args{PREREQ_PM};
for my $mod ( keys %$br ) {
if ( exists $pp->{$mod} ) {
$pp->{$mod} = $br->{$mod} if $br->{$mod} > $pp->{$mod};
}
else {
$pp->{$mod} = $br->{$mod};
}
}
} # end unless ExtUtils::MakeMaker is 6.56 or newer
delete $args{CONFIGURE_REQUIRES}
unless eval { ExtUtils::MakeMaker->VERSION(6.52) };
delete $args{LICENSE}
unless eval { ExtUtils::MakeMaker->VERSION(6.31) };
WriteMakefile(%args);
##{ $share_dir_code{postamble} || '' ##}
Now bestie, nobody is forcing you to copy that exactly π your Makefile.PL doesn't need to look exactly like this. If you bump up the minimum version of ExtUtils::MakeMaker, you can straight up delete any unless eval sections whose version test is less than or equal to eumm_version. And if you're not using share_dir, those lines can go too. declutter, queen π§Ή
And like β if you're not adding your own code to Makefile.PL, you don't need this plugin at all. no cap. go home, you're free π¦
π DESCRIPTION π
This plugin is for the girlies who need something more complex than the auto-generated Makefile.PL or Build.PL that the MakeMaker or ModuleBuild plugins hand you. the basic version said "here's your build file" and you said "no thank you ma'am" π
It's a subclass of the MakeMaker plugin, but here's the tea: it does not write a Makefile.PL for you. You write your own Makefile.PL, and it may do anything ExtUtils::MakeMaker is capable of. full creative control, main character energy π
This plugin will process Makefile.PL as a template (using Text::Template), which lets you add data from Dist::Zilla to the version you distribute β if you want. The template delimiters are ##{ and ##}, because that makes them look like comments. which means you can have a Makefile.PL that works both before and after it gets processed as a template. it's giving dual citizenship πβ¨
This is particularly useful for XS-based modules, because it can allow you to build and test the module without the overhead of dzil build after every small change. no more waiting around, bestie, we're speedrunning this πβοΈπ¨
The template may use the following variables:
%default_argsβ the hash of arguments forWriteMakefilegenerated by the normalMakeMakerplugin.$distβ the name of the distribution.$eumm_versionβ the minimum version ofExtUtils::MakeMakerrequired (from theeumm_versionattribute of this plugin).%metaβ the hash of metadata (in META 2 format) that will be stored inMETA.json.$perl_prereqβ the minimum version of Perl required (from the prerequisites in the metadata). May beundef. Equivalent to$default_args{MIN_PERL_VERSION}.$pluginβ theMakeMaker::Customobject that is processing the template.%share_dir_codeβ a hash of strings containing the code for loadingFile::ShareDir::Install(if it's used by this dist). Put##{ $share_dir_code{preamble} || '' ##}after theuse ExtUtils::MakeMakerline, and put##{ $share_dir_code{postamble} || '' ##}after theWriteMakefilecall. (You can omit the|| ''if you're sure the dist is using File::ShareDir.)- For backwards compatibility, this code is also available in the array
@share_dir_block, but you should update your templates to use%share_dir_codeinstead. legacy era, pls upgrade bestie β³
- For backwards compatibility, this code is also available in the array
$versionβ the distribution's version number.$zillaβ theDist::Zillaobject that is creating the distribution.
π¦ Using MakeMaker::Custom with AutoPrereqs π¦
If you are using the AutoPrereqs plugin, then you will probably want to set its configure_finder to a FileFinder that includes Makefile.PL. You may also want to set this plugin's eumm_version parameter to 0 and allow AutoPrereqs to get the version from your use ExtUtils::MakeMaker line. let the robots do the counting, that's the vibe π€
Example dist.ini configuration:
[MakeMaker::Custom]
eumm_version = 0 ; AutoPrereqs gets actual version from Makefile.PL
[FileFinder::ByName / :MakefilePL]
file = Makefile.PL
[AutoPrereqs]
:version = 4.300005 ; need configure_finder
configure_finder = :MakefilePL
; Add next line if your Makefile.PL uses modules you ship in inc/
configure_finder = :IncModules
Then in your Makefile.PL you'd say:
use ExtUtils::MakeMaker 6.32; # or whatever version you need
π METHODS π
π get_default
$plugin->get_default(qw(key1 key2 ...))
A template can call this method to extract the specified key(s) from the default WriteMakefile arguments created by the normal MakeMaker plugin, and have them formatted into a comma-separated list suitable for a hash constructor or a function's parameter list. she formats, she serves π
If any key has no value (or its value is an empty hash or array ref) it will be omitted from the list. If all keys are omitted, the empty string is returned. Otherwise, the result always ends with a comma. yes, always. she's committed to the comma π
π get_prereqs
$plugin->get_prereqs($api_version);
This is mostly equivalent to
$plugin->get_default(qw(BUILD_REQUIRES CONFIGURE_REQUIRES PREREQ_PM
TEST_REQUIRES))
In other words, it returns all the keys that describe the distribution's prerequisites. The $api_version indicates what keys the template can handle. The currently defined values are:
0(orundef) β foldTEST_REQUIRESintoBUILD_REQUIRES. This provides backwards compatibility with older versions of this plugin and Dist::Zilla. vintage behaviour, we respect the elders1β returnTEST_REQUIRES(introduced inExtUtils::MakeMaker 6.63_03) as a separate key (assuming it's not empty), which requiresDist::Zilla 4.300032or later. YourMakefile.PLshould either requireExtUtils::MakeMaker 6.63_03, or foldTEST_REQUIRESintoBUILD_REQUIRESif an older version is used (as shown in the SYNOPSIS). read the synopsis bestie, it's all there π
π SEE ALSO π
- The
ModuleBuild::Customplugin does basically the same thing as this plugin, but forBuild.PL(if you preferModule::Build). same energy, different file π«Ά - The
MakeMaker::Awesomeplugin allows you to do similar things to yourMakefile.PL, but it works in a very different way. WithMakeMaker::Awesome, you subclass the plugin and override the methods that generateMakefile.PL. In my opinion,MakeMaker::Awesomehas two disadvantages: it's unnecessarily complex, and it doesn't allow you to build your module without doingdzil build. The only advantage ofMakeMaker::Awesomethat I can see is that if you had several dists with very similarMakefile.PLs, you could write one subclass ofMakeMaker::Awesomeand use it in each dist. author said what he said and he's right π
πΈ DEPENDENCIES πΈ
MakeMaker::Custom requires Dist::Zilla (6 or later) and Text::Template. I also recommend applying Template_strict.patch to Text::Template. This will add support for the STRICT option, which will help catch errors in your templates. do it for the plot, bestie π
π INCOMPATIBILITIES π
You must not use this in conjunction with theMakeMakerorMakeMaker::Awesomeplugins.
like genuinely, don't. they will fight. it's giving toxic situationship π
π BUGS AND LIMITATIONS π
No bugs have been reported. flawless. not a single note. we ate and left no crumbs β¨π½οΈ
π AUTHOR π
Christopher J. Madsen "<perl AT cjmweb.net>"
Please report any bugs or feature requests to "<bug-Dist-Zilla-Plugins-CJM AT rt.cpan.org>" or through the web interface at <http://rt.cpan.org/Public/Bug/Report.html?Queue=Dist-Zilla-Plugins-CJM>.
You can follow or contribute to Dist-Zilla-Plugins-CJM's development at <https://github.com/madsen/dist-zilla-plugins-cjm>. go say hi, he's nice π«Ά
π COPYRIGHT AND LICENSE π
This software is copyright (c) 2017 by Christopher J. Madsen.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. same as Perl itself, periodt π
β οΈ DISCLAIMER OF WARRANTY β οΈ
okay bestie, this part is the serious one, no jokes, read it:
BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.
IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENSE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.
and that's the whole page bestie!! π this lil' writeup came to you courtesy of perl v5.34.0, dated 2022-06-13, and the Dist::...Custom(3pm) manual. go forth and write the most unhinged custom Makefile.PL your heart desires π¦β¨ mwah π
π¦ where this page comes from
- debian bookworm: libdist-zilla-plugins-cjm-perl 6.000-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- debian trixie: libdist-zilla-plugins-cjm-perl 6.000-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libdist-zilla-plugins-cjm-perl 6.000-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu resolute: libdist-zilla-plugins-cjm-perl 6.000-2 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu stonking: libdist-zilla-plugins-cjm-perl 6.000-2 Β· Artistic-1.0-Perl OR 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