.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.42) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is >0, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{\ . if \nF \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" ======================================================================== .\" .IX Title "Dist::Zilla::Plugin::MakeMaker::Custom 3pm" .TH Dist::Zilla::Plugin::MakeMaker::Custom 3pm "2022-06-13" "perl v5.34.0" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Dist::Zilla::Plugin::MakeMaker::Custom \- Allow a dist to have a custom Makefile.PL .SH "VERSION" .IX Header "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. .SH "SYNOPSIS" .IX Header "SYNOPSIS" In \fIdist.ini\fR: .PP .Vb 2 \& [MakeMaker::Custom] \& eumm_version = 0.34 ; the default comes from the MakeMaker plugin .Ve .PP In your \fIMakefile.PL\fR: .PP .Vb 1 \& use ExtUtils::MakeMaker; \& \& ##{ $share_dir_code{preamble} || \*(Aq\*(Aq ##} \& \& 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} || \*(Aq\*(Aq ##} .Ve .PP Of course, your \fIMakefile.PL\fR doesn't need to look exactly like this. If you increase the minimum version of ExtUtils::MakeMaker, you can remove any \f(CW\*(C`unless eval\*(C'\fR sections whose version test is less than or equal to \f(CW\*(C`eumm_version\*(C'\fR. If you're not using \f(CW\*(C`share_dir\*(C'\fR, you can remove those lines. .PP And if you're not adding your own code to \fIMakefile.PL\fR, you don't need this plugin. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This plugin is for people who need something more complex than the auto-generated \fIMakefile.PL\fR or \fIBuild.PL\fR generated by the MakeMaker or ModuleBuild plugins. .PP It is a subclass of the MakeMaker plugin, but it does not write a \fIMakefile.PL\fR for you. Instead, you write your own \fIMakefile.PL\fR, which may do anything ExtUtils::MakeMaker is capable of. .PP This plugin will process \fIMakefile.PL\fR as a template (using Text::Template), which allows you to add data from Dist::Zilla to the version you distribute (if you want). The template delimiters are \&\f(CW\*(C`##{\*(C'\fR and \f(CW\*(C`##}\*(C'\fR, because that makes them look like comments. That makes it easier to have a \fIMakefile.PL\fR that works both before and after it is processed as a template. .PP This is particularly useful for XS-based modules, because it can allow you to build and test the module without the overhead of \f(CW\*(C`dzil build\*(C'\fR after every small change. .PP The template may use the following variables: .ie n .IP "%default_args" 4 .el .IP "\f(CW%default_args\fR" 4 .IX Item "%default_args" The hash of arguments for WriteMakefile generated by the normal MakeMaker plugin. .ie n .IP "$dist" 4 .el .IP "\f(CW$dist\fR" 4 .IX Item "$dist" The name of the distribution. .ie n .IP "$eumm_version" 4 .el .IP "\f(CW$eumm_version\fR" 4 .IX Item "$eumm_version" The minimum version of ExtUtils::MakeMaker required (from the \f(CW\*(C`eumm_version\*(C'\fR attribute of this plugin). .ie n .IP "%meta" 4 .el .IP "\f(CW%meta\fR" 4 .IX Item "%meta" The hash of metadata (in \s-1META 2\s0 format) that will be stored in \fI\s-1META\s0.json\fR. .ie n .IP "$perl_prereq" 4 .el .IP "\f(CW$perl_prereq\fR" 4 .IX Item "$perl_prereq" The minimum version of Perl required (from the prerequisites in the metadata). May be \f(CW\*(C`undef\*(C'\fR. Equivalent to \f(CW$default_args{MIN_PERL_VERSION}\fR. .ie n .IP "$plugin" 4 .el .IP "\f(CW$plugin\fR" 4 .IX Item "$plugin" The MakeMaker::Custom object that is processing the template. .ie n .IP "%share_dir_code" 4 .el .IP "\f(CW%share_dir_code\fR" 4 .IX Item "%share_dir_code" A hash of strings containing the code for loading \&\f(CW\*(C`File::ShareDir::Install\*(C'\fR (if it's used by this dist). Put \&\f(CW\*(C`##{ $share_dir_code{preamble} || \*(Aq\*(Aq ##}\*(C'\fR after the \&\f(CW\*(C`use ExtUtils::MakeMaker\*(C'\fR line, and put \&\f(CW\*(C`##{ $share_dir_code{postamble} || \*(Aq\*(Aq ##}\*(C'\fR after the \f(CW\*(C`WriteMakefile\*(C'\fR call. (You can omit the \f(CW\*(C`|| \*(Aq\*(Aq\*(C'\fR if you're sure the dist is using File::ShareDir. .Sp For backwards compatibility, this code is also available in the array \&\f(CW@share_dir_block\fR, but you should update your templates to use \&\f(CW%share_dir_code\fR instead. .ie n .IP "$version" 4 .el .IP "\f(CW$version\fR" 4 .IX Item "$version" The distribution's version number. .ie n .IP "$zilla" 4 .el .IP "\f(CW$zilla\fR" 4 .IX Item "$zilla" The Dist::Zilla object that is creating the distribution. .SS "Using MakeMaker::Custom with AutoPrereqs" .IX Subsection "Using MakeMaker::Custom with AutoPrereqs" If you are using the AutoPrereqs plugin, then you will probably want to set its \f(CW\*(C`configure_finder\*(C'\fR to a FileFinder that includes \fIMakefile.PL\fR. You may also want to set this plugin's \f(CW\*(C`eumm_version\*(C'\fR parameter to 0 and allow AutoPrereqs to get the version from your \f(CW\*(C`use ExtUtils::MakeMaker\*(C'\fR line. .PP Example \fIdist.ini\fR configuration: .PP .Vb 2 \& [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 .Ve .PP Then in your \fIMakefile.PL\fR you'd say: .PP .Vb 1 \& use ExtUtils::MakeMaker 6.32; # or whatever version you need .Ve .SH "METHODS" .IX Header "METHODS" .SS "get_default" .IX Subsection "get_default" .Vb 1 \& $plugin\->get_default(qw(key1 key2 ...)) .Ve .PP 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. .PP 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. .SS "get_prereqs" .IX Subsection "get_prereqs" .Vb 1 \& $plugin\->get_prereqs($api_version); .Ve .PP This is mostly equivalent to .PP .Vb 2 \& $plugin\->get_default(qw(BUILD_REQUIRES CONFIGURE_REQUIRES PREREQ_PM \& TEST_REQUIRES)) .Ve .PP In other words, it returns all the keys that describe the distribution's prerequisites. The \f(CW$api_version\fR indicates what keys the template can handle. The currently defined values are: .ie n .IP "0 (or undef) \- Fold \s-1TEST_REQUIRES\s0 into \s-1BUILD_REQUIRES.\s0 This provides backwards compatibility with older versions of this plugin and Dist::Zilla." 8 .el .IP "\f(CW0\fR (or undef) \- Fold \s-1TEST_REQUIRES\s0 into \s-1BUILD_REQUIRES.\s0 This provides backwards compatibility with older versions of this plugin and Dist::Zilla." 8 .IX Item "0 (or undef) - Fold TEST_REQUIRES into BUILD_REQUIRES. This provides backwards compatibility with older versions of this plugin and Dist::Zilla." .PD 0 .ie n .IP "1 \- Return \s-1TEST_REQUIRES\s0 (introduced in ExtUtils::MakeMaker 6.63_03) as a separate key (assuming it's not empty), which requires Dist::Zilla 4.300032 or later. Your \fIMakefile.PL\fR should either require ExtUtils::MakeMaker 6.63_03, or fold \s-1TEST_REQUIRES\s0 into \s-1BUILD_REQUIRES\s0 if an older version is used (as shown in the \s-1SYNOPSIS\s0)." 8 .el .IP "\f(CW1\fR \- Return \s-1TEST_REQUIRES\s0 (introduced in ExtUtils::MakeMaker 6.63_03) as a separate key (assuming it's not empty), which requires Dist::Zilla 4.300032 or later. Your \fIMakefile.PL\fR should either require ExtUtils::MakeMaker 6.63_03, or fold \s-1TEST_REQUIRES\s0 into \s-1BUILD_REQUIRES\s0 if an older version is used (as shown in the \s-1SYNOPSIS\s0)." 8 .IX Item "1 - Return TEST_REQUIRES (introduced in ExtUtils::MakeMaker 6.63_03) as a separate key (assuming it's not empty), which requires Dist::Zilla 4.300032 or later. Your Makefile.PL should either require ExtUtils::MakeMaker 6.63_03, or fold TEST_REQUIRES into BUILD_REQUIRES if an older version is used (as shown in the SYNOPSIS)." .PD .SH "SEE ALSO" .IX Header "SEE ALSO" The ModuleBuild::Custom plugin does basically the same thing as this plugin, but for \&\fIBuild.PL\fR (if you prefer Module::Build). .PP The MakeMaker::Awesome plugin allows you to do similar things to your \fIMakefile.PL\fR, but it works in a very different way. With MakeMaker::Awesome, you subclass the plugin and override the methods that generate \fIMakefile.PL\fR. In my opinion, MakeMaker::Awesome has two disadvantages: it's unnecessarily complex, and it doesn't allow you to build your module without doing \f(CW\*(C`dzil build\*(C'\fR. The only advantage of MakeMaker::Awesome that I can see is that if you had several dists with very similar \&\fIMakefile.PL\fRs, you could write one subclass of MakeMaker::Awesome and use it in each dist. .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" MakeMaker::Custom requires Dist::Zilla (6 or later) and Text::Template. I also recommend applying \fITemplate_strict.patch\fR to Text::Template. This will add support for the \s-1STRICT\s0 option, which will help catch errors in your templates. .SH "INCOMPATIBILITIES" .IX Header "INCOMPATIBILITIES" You must not use this in conjunction with the MakeMaker or MakeMaker::Awesome plugins. .SH "BUGS AND LIMITATIONS" .IX Header "BUGS AND LIMITATIONS" No bugs have been reported. .SH "AUTHOR" .IX Header "AUTHOR" Christopher J. Madsen \f(CW\*(C`\*(C'\fR .PP Please report any bugs or feature requests to \f(CW\*(C`\*(C'\fR or through the web interface at . .PP You can follow or contribute to Dist-Zilla-Plugins-CJM's development at . .SH "COPYRIGHT AND LICENSE" .IX Header "COPYRIGHT AND LICENSE" This software is copyright (c) 2017 by Christopher J. Madsen. .PP This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" \&\s-1BECAUSE 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 \*(L"AS IS\*(R" 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.\s0 .PP \&\s-1IN 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\s0 (\s-1INCLUDING 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\s0), \s-1EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\s0