.\" Automatically generated by Pod::Man 4.07 (Pod::Simple 3.32) .\" .\" 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 .. .if !\nF .nr F 0 .if \nF>0 \{\ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{\ . nr % 0 . nr F 2 . \} .\} .\" ======================================================================== .\" .IX Title "Dist::Zilla::Plugin::ModuleBuild::Custom 3pm" .TH Dist::Zilla::Plugin::ModuleBuild::Custom 3pm "2016-11-12" "perl v5.24.1" "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::ModuleBuild::Custom \- Allow a dist to have a custom Build.PL .SH "VERSION" .IX Header "VERSION" This document describes version 4.26 of Dist::Zilla::Plugin::ModuleBuild::Custom, released August 29, 2015 as part of Dist-Zilla-Plugins-CJM version 4.27. .SH "SYNOPSIS" .IX Header "SYNOPSIS" In \fIdist.ini\fR: .PP .Vb 2 \& [ModuleBuild::Custom] \& mb_version = 0.34 ; the default comes from the ModuleBuild plugin .Ve .PP In your \fIBuild.PL\fR: .PP .Vb 1 \& use Module::Build; \& \& my %module_build_args = ( \& module_name => \*(AqFoo::Bar\*(Aq, \& ##{ $plugin\->get_prereqs(1) ##} \& ##{ $plugin\->get_default(\*(Aqshare_dir\*(Aq) ##} \& ); \& \& unless ( eval { Module::Build\->VERSION(0.4004) } ) { \& my $tr = delete $module_build_args{test_requires}; \& my $br = $module_build_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 Module::Build is 0.4004 or newer \& \& my $builder = Module::Build\->new(%module_build_args); \& $builder\->create_build_script; .Ve .PP Of course, your \fIBuild.PL\fR doesn't need to look exactly like this. If you can require Module::Build 0.4004, then you can remove the \&\f(CW\*(C`unless eval\*(C'\fR section. If you're not using \f(CW\*(C`share_dir\*(C'\fR, you can remove that line. .PP And if you're not adding your own code to \fIBuild.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 ModuleBuild plugin, but it does not write a \fIBuild.PL\fR for you. Instead, you write your own \fIBuild.PL\fR, which may do anything Module::Build is capable of (except generate a compatibility \fIMakefile.PL\fR). .PP This plugin will process \fIBuild.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 \fIBuild.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 "$dist" 4 .el .IP "\f(CW$dist\fR" 4 .IX Item "$dist" The name of the distribution. .ie n .IP "$meta" 4 .el .IP "\f(CW$meta\fR" 4 .IX Item "$meta" The hash of metadata (in \s-1META 1.4\s0 format) that will be stored in \fI\s-1META\s0.yml\fR. .ie n .IP "$meta2" 4 .el .IP "\f(CW$meta2\fR" 4 .IX Item "$meta2" The hash of metadata (in \s-1META 2\s0 format) that will be stored in \fI\s-1META\s0.json\fR. .ie n .IP "$plugin" 4 .el .IP "\f(CW$plugin\fR" 4 .IX Item "$plugin" The ModuleBuild::Custom object that is processing the template. .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 ModuleBuild::Custom with AutoPrereqs" .IX Subsection "Using ModuleBuild::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 \fIBuild.PL\fR. You may also want to set this plugin's \f(CW\*(C`mb_version\*(C'\fR parameter to 0 and allow AutoPrereqs to get the version from your \f(CW\*(C`use Module::Build\*(C'\fR line. .PP Example \fIdist.ini\fR configuration: .PP .Vb 2 \& [ModuleBuild::Custom] \& mb_version = 0 ; AutoPrereqs gets actual version from Build.PL \& \& [FileFinder::ByName / :BuildPL] \& file = Build.PL \& \& [AutoPrereqs] \& :version = 4.300005 ; need configure_finder \& configure_finder = :BuildPL \& ; Add next line if your Build.PL uses modules you ship in inc/ \& configure_finder = :IncModules .Ve .PP Then in your \fIBuild.PL\fR you'd say: .PP .Vb 1 \& use Module::Build 0.28; # 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 Module::Build arguments created by the normal ModuleBuild plugin and have them formatted into a comma-separated list suitable for a hash constructor or a method'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. .PP The most common usage would be .PP .Vb 1 \& ##{ $plugin\->get_default(\*(Aqshare_dir\*(Aq) ##} .Ve .SS "get_meta" .IX Subsection "get_meta" .Vb 1 \& $plugin\->get_meta(qw(key1 key2 ...)) .Ve .PP A template can call this method to extract the specified key(s) from \&\f(CW\*(C`distmeta\*(C'\fR and have them formatted into a comma-separated list suitable for a hash constructor or a method's parameter list. The keys (and the returned values) are from the \s-1META 1.4\s0 spec, because that's what Module::Build uses in its \s-1API.\s0 .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 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)" 8 .el .IP "\f(CW0\fR (or undef)" 8 .IX Item "0 (or undef)" This is equivalent to .Sp .Vb 2 \& $plugin\->get_meta(qw(build_requires configure_requires requires \& recommends conflicts)) .Ve .ie n .IP "1" 8 .el .IP "\f(CW1\fR" 8 .IX Item "1" This adds \f(CW\*(C`test_requires\*(C'\fR as a separate key (which requires Dist::Zilla 4.300032 or later). It's equivalent to .Sp .Vb 2 \& $plugin\->get_default(qw(build_requires configure_requires requires \& test_requires recommends conflicts)) .Ve .Sp Your \fIBuild.PL\fR should either require Module::Build 0.4004, or fold test_requires into build_requires if an older version is used (as shown in the \s-1SYNOPSIS\s0). .SH "SEE ALSO" .IX Header "SEE ALSO" The MakeMaker::Custom plugin does basically the same thing as this plugin, but for \&\fIMakefile.PL\fR (if you prefer ExtUtils::MakeMaker). .SH "DEPENDENCIES" .IX Header "DEPENDENCIES" ModuleBuild::Custom requires Dist::Zilla (4.300009 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 ModuleBuild plugin. .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) 2015 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