.\" Automatically generated by Pod::Man 2.22 (Pod::Simple 3.13)
.\"
.\" 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" ''
'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 turned on, 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.
.ie \nF \{\
. de IX
. tm Index:\\$1\t\\n%\t"\\$2"
..
. nr % 0
. rr F
.\}
.el \{\
. de IX
..
.\}
.\" ========================================================================
.\"
.IX Title "ExtUtils::MakeMaker::FAQ 3"
.TH ExtUtils::MakeMaker::FAQ 3 "2023-03-26" "perl v5.10.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"
ExtUtils::MakeMaker::FAQ \- Frequently Asked Questions About MakeMaker
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
FAQs, tricks and tips for ExtUtils::MakeMaker.
.SS "Module Installation"
.IX Subsection "Module Installation"
.IP "How do I install a module into my home directory?" 4
.IX Item "How do I install a module into my home directory?"
If you're not the Perl administrator you probably don't have
permission to install a module to its default location. Ways of handling
this with a \fBlot\fR less manual effort on your part are perlbrew
and local::lib.
.Sp
Otherwise, you can install it for your own use into your home directory
like so:
.Sp
.Vb 2
\& # Non\-unix folks, replace ~ with /path/to/your/home/dir
\& perl Makefile.PL INSTALL_BASE=~
.Ve
.Sp
This will put modules into \fI~/lib/perl5\fR, man pages into \fI~/man\fR and
programs into \fI~/bin\fR.
.Sp
To ensure your Perl programs can see these newly installed modules,
set your \f(CW\*(C`PERL5LIB\*(C'\fR environment variable to \fI~/lib/perl5\fR or tell
each of your programs to look in that directory with the following:
.Sp
.Vb 1
\& use lib "$ENV{HOME}/lib/perl5";
.Ve
.Sp
or if \f(CW$ENV\fR{\s-1HOME\s0} isn't set and you don't want to set it for some
reason, do it the long way.
.Sp
.Vb 1
\& use lib "/path/to/your/home/dir/lib/perl5";
.Ve
.IP "How do I get MakeMaker and Module::Build to install to the same place?" 4
.IX Item "How do I get MakeMaker and Module::Build to install to the same place?"
Module::Build, as of 0.28, supports two ways to install to the same
location as MakeMaker.
.Sp
We highly recommend the install_base method, its the simplest and most
closely approximates the expected behavior of an installation prefix.
.Sp
1) Use \s-1INSTALL_BASE\s0 / \f(CW\*(C`\-\-install_base\*(C'\fR
.Sp
MakeMaker (as of 6.31) and Module::Build (as of 0.28) both can install
to the same locations using the \*(L"install_base\*(R" concept. See
\&\*(L"\s-1INSTALL_BASE\s0\*(R" in ExtUtils::MakeMaker for details. To get \s-1MM\s0 and \s-1MB\s0 to
install to the same location simply set \s-1INSTALL_BASE\s0 in \s-1MM\s0 and
\&\f(CW\*(C`\-\-install_base\*(C'\fR in \s-1MB\s0 to the same location.
.Sp
.Vb 2
\& perl Makefile.PL INSTALL_BASE=/whatever
\& perl Build.PL \-\-install_base /whatever
.Ve
.Sp
This works most like other language's behavior when you specify a
prefix. We recommend this method.
.Sp
2) Use \s-1PREFIX\s0 / \f(CW\*(C`\-\-prefix\*(C'\fR
.Sp
Module::Build 0.28 added support for \f(CW\*(C`\-\-prefix\*(C'\fR which works like
MakeMaker's \s-1PREFIX\s0.
.Sp
.Vb 2
\& perl Makefile.PL PREFIX=/whatever
\& perl Build.PL \-\-prefix /whatever
.Ve
.Sp
We highly discourage this method. It should only be used if you know
what you're doing and specifically need the \s-1PREFIX\s0 behavior. The
\&\s-1PREFIX\s0 algorithm is complicated and focused on matching the system
installation.
.IP "How do I keep from installing man pages?" 4
.IX Item "How do I keep from installing man pages?"
Recent versions of MakeMaker will only install man pages on Unix-like
operating systems by default. To generate manpages on non-Unix operating
systems, make the \*(L"manifypods\*(R" target.
.Sp
For an individual module:
.Sp
.Vb 1
\& perl Makefile.PL INSTALLMAN1DIR=none INSTALLMAN3DIR=none
.Ve
.Sp
If you want to suppress man page installation for all modules you have
to reconfigure Perl and tell it 'none' when it asks where to install
man pages.
.IP "How do I use a module without installing it?" 4
.IX Item "How do I use a module without installing it?"
Two ways. One is to build the module normally...
.Sp
.Vb 3
\& perl Makefile.PL
\& make
\& make test
.Ve
.Sp
\&...and then use blib to point Perl at the built but uninstalled module:
.Sp
.Vb 2
\& perl \-Mblib script.pl
\& perl \-Mblib \-e \*(Aq...\*(Aq
.Ve
.Sp
The other is to install the module in a temporary location.
.Sp
.Vb 4
\& perl Makefile.PL INSTALL_BASE=~/tmp
\& make
\& make test
\& make install
.Ve
.Sp
And then set \s-1PERL5LIB\s0 to \fI~/tmp/lib/perl5\fR. This works well when you
have multiple modules to work with. It also ensures that the module
goes through its full installation process which may modify it.
Again, local::lib may assist you here.
.IP "How can I organize tests into subdirectories and have them run?" 4
.IX Item "How can I organize tests into subdirectories and have them run?"
Let's take the following test directory structure:
.Sp
.Vb 3
\& t/foo/sometest.t
\& t/bar/othertest.t
\& t/bar/baz/anothertest.t
.Ve
.Sp
Now, inside of the \f(CW\*(C`WriteMakefile()\*(C'\fR function in your \fIMakefile.PL\fR, specify
where your tests are located with the \f(CW\*(C`test\*(C'\fR directive:
.Sp
.Vb 1
\& test => {TESTS => \*(Aqt/*.t t/*/*.t t/*/*/*.t\*(Aq}
.Ve
.Sp
The first entry in the string will run all tests in the top-level \fIt/\fR
directory. The second will run all test files located in any subdirectory under
\&\fIt/\fR. The third, runs all test files within any subdirectory within any other
subdirectory located under \fIt/\fR.
.Sp
Note that you do not have to use wildcards. You can specify explicitly which
subdirectories to run tests in:
.Sp
.Vb 1
\& test => {TESTS => \*(Aqt/*.t t/foo/*.t t/bar/baz/*.t\*(Aq}
.Ve
.IP "\s-1PREFIX\s0 vs \s-1INSTALL_BASE\s0 from Module::Build::Cookbook" 4
.IX Item "PREFIX vs INSTALL_BASE from Module::Build::Cookbook"
The behavior of \s-1PREFIX\s0 is complicated and depends closely on how your
Perl is configured. The resulting installation locations will vary
from machine to machine and even different installations of Perl on the
same machine. Because of this, its difficult to document where prefix
will place your modules.
.Sp
In contrast, \s-1INSTALL_BASE\s0 has predictable, easy to explain installation
locations. Now that Module::Build and MakeMaker both have \s-1INSTALL_BASE\s0
there is little reason to use \s-1PREFIX\s0 other than to preserve your existing
installation locations. If you are starting a fresh Perl installation we
encourage you to use \s-1INSTALL_BASE\s0. If you have an existing installation
installed via \s-1PREFIX\s0, consider moving it to an installation structure
matching \s-1INSTALL_BASE\s0 and using that instead.
.ie n .IP "Generating *.pm files with substitutions eg of $VERSION" 4
.el .IP "Generating *.pm files with substitutions eg of \f(CW$VERSION\fR" 4
.IX Item "Generating *.pm files with substitutions eg of $VERSION"
If you want to configure your module files for local conditions, or to
automatically insert a version number, you can use \s-1EUMM\s0's \f(CW\*(C`PL_FILES\*(C'\fR
capability, where it will automatically run each \fI*.PL\fR it finds to
generate its basename. For instance:
.Sp
.Vb 10
\& # Makefile.PL:
\& require \*(Aqcommon.pl\*(Aq;
\& my $version = get_version();
\& my @pms = qw(Foo.pm);
\& WriteMakefile(
\& NAME => \*(AqFoo\*(Aq,
\& VERSION => $version,
\& PM => { map { ($_ => "\e$(INST_LIB)/$_") } @pms },
\& clean => { FILES => join \*(Aq \*(Aq, @pms },
\& );
\&
\& # common.pl:
\& sub get_version { \*(Aq0.04\*(Aq }
\& sub process { my $v = get_version(); s/_\|_VERSION_\|_/$v/g; }
\& 1;
\&
\& # Foo.pm.PL:
\& require \*(Aqcommon.pl\*(Aq;
\& $_ = join \*(Aq\*(Aq,