.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Module::Build::Bundling 3pm" .TH Module::Build::Bundling 3pm "2023-12-02" "perl v5.36.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" Module::Build::Bundling \- How to bundle Module::Build with a distribution .SH "SYNOPSIS" .IX Header "SYNOPSIS" .Vb 2 \& # Build.PL \& use inc::latest \*(AqModule::Build\*(Aq; \& \& Module::Build\->new( \& module_name => \*(AqFoo::Bar\*(Aq, \& license => \*(Aqperl\*(Aq, \& )\->create_build_script; .Ve .SH "DESCRIPTION" .IX Header "DESCRIPTION" \&\fB\s-1WARNING\s0 \*(-- \s-1THIS IS AN EXPERIMENTAL FEATURE\s0\fR .PP In order to install a distribution using Module::Build, users must have Module::Build available on their systems. There are two ways to do this. The first way is to include Module::Build in the \&\f(CW\*(C`configure_requires\*(C'\fR metadata field. This field is supported by recent versions \s-1CPAN\s0 and \s-1CPANPLUS\s0 and is a standard feature in the Perl core as of Perl 5.10.1. Module::Build now adds itself to \f(CW\*(C`configure_requires\*(C'\fR by default. .PP The second way supports older Perls that have not upgraded \s-1CPAN\s0 or \&\s-1CPANPLUS\s0 and involves bundling an entire copy of Module::Build into the distribution's \f(CW\*(C`inc/\*(C'\fR directory. This is the same approach used by Module::Install, a modern wrapper around ExtUtils::MakeMaker for Makefile.PL based distributions. .PP The \*(L"trick\*(R" to making this work for Module::Build is making sure the highest version Module::Build is used, whether this is in \f(CW\*(C`inc/\*(C'\fR or already installed on the user's system. This ensures that all necessary features are available as well as any new bug fixes. This is done using the experimental inc::latest module, available on \s-1CPAN.\s0 .PP A \*(L"normal\*(R" Build.PL looks like this (with only the minimum required fields): .PP .Vb 1 \& use Module::Build; \& \& Module::Build\->new( \& module_name => \*(AqFoo::Bar\*(Aq, \& license => \*(Aqperl\*(Aq, \& )\->create_build_script; .Ve .PP A \*(L"bundling\*(R" Build.PL replaces the initial \*(L"use\*(R" line with a nearly transparent replacement: .PP .Vb 1 \& use inc::latest \*(AqModule::Build\*(Aq; \& \& Module::Build\->new( \& module_name => \*(AqFoo::Bar\*(Aq, \& license => \*(Aqperl\*(Aq, \& )\->create_build_script; .Ve .PP For \fIauthors\fR, when \*(L"Build dist\*(R" is run, Module::Build will be automatically bundled into \f(CW\*(C`inc\*(C'\fR according to the rules for inc::latest. .PP For \fIusers\fR, inc::latest will load the latest Module::Build, whether installed or bundled in \f(CW\*(C`inc/\*(C'\fR. .SH "BUNDLING OTHER CONFIGURATION DEPENDENCIES" .IX Header "BUNDLING OTHER CONFIGURATION DEPENDENCIES" The same approach works for other configuration dependencies \*(-- modules that \fImust\fR be available for Build.PL to run. All other dependencies can be specified as usual in the Build.PL and \s-1CPAN\s0 or \s-1CPANPLUS\s0 will install them after Build.PL finishes. .PP For example, to bundle the Devel::AssertOS::Unix module (which ensures a \&\*(L"Unix-like\*(R" operating system), one could do this: .PP .Vb 2 \& use inc::latest \*(AqDevel::AssertOS::Unix\*(Aq; \& use inc::latest \*(AqModule::Build\*(Aq; \& \& Module::Build\->new( \& module_name => \*(AqFoo::Bar\*(Aq, \& license => \*(Aqperl\*(Aq, \& )\->create_build_script; .Ve .PP The \f(CW\*(C`inc::latest\*(C'\fR module creates bundled directories based on the packlist file of an installed distribution. Even though \f(CW\*(C`inc::latest\*(C'\fR takes module name arguments, it is better to think of it as bundling and making available entire \fIdistributions\fR. When a module is loaded through \&\f(CW\*(C`inc::latest\*(C'\fR, it looks in all bundled distributions in \f(CW\*(C`inc/\*(C'\fR for a newer module than can be found in the existing \f(CW@INC\fR array. .PP Thus, the module-name provided should usually be the \*(L"top-level\*(R" module name of a distribution, though this is not strictly required. For example, Module::Build has a number of heuristics to map module names to packlists, allowing users to do things like this: .PP .Vb 1 \& use inc::latest \*(AqDevel::AssertOS::Unix\*(Aq; .Ve .PP even though Devel::AssertOS::Unix is contained within the Devel-CheckOS distribution. .PP At the current time, packlists are required. Thus, bundling dual-core modules, \fIincluding Module::Build\fR, may require a 'forced install' over versions in the latest version of perl in order to create the necessary packlist for bundling. This limitation will hopefully be addressed in a future version of Module::Build. .SS "\s-1WARNING\s0 \*(-- How to Manage Dependency Chains" .IX Subsection "WARNING How to Manage Dependency Chains" Before bundling a distribution you must ensure that all prerequisites are also bundled and load in the correct order. For Module::Build itself, this should not be necessary, but it is necessary for any other distribution. (A future release of Module::Build will hopefully address this deficiency.) .PP For example, if you need \f(CW\*(C`Wibble\*(C'\fR, but \f(CW\*(C`Wibble\*(C'\fR depends on \f(CW\*(C`Wobble\*(C'\fR, your Build.PL might look like this: .PP .Vb 3 \& use inc::latest \*(AqWobble\*(Aq; \& use inc::latest \*(AqWibble\*(Aq; \& use inc::latest \*(AqModule::Build\*(Aq; \& \& Module::Build\->new( \& module_name => \*(AqFoo::Bar\*(Aq, \& license => \*(Aqperl\*(Aq, \& )\->create_build_script; .Ve .PP Authors are strongly suggested to limit the bundling of additional dependencies if at all possible and to carefully test their distribution tarballs on older versions of Perl before uploading to \s-1CPAN.\s0 .SH "AUTHOR" .IX Header "AUTHOR" David Golden .PP Development questions, bug reports, and patches should be sent to the Module-Build mailing list at . .PP Bug reports are also welcome at . .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fBperl\fR\|(1), inc::latest, Module::Build(3), Module::Build::API(3), Module::Build::Cookbook(3),