1Module::Install::FAQ(3)User Contributed Perl DocumentatioMnodule::Install::FAQ(3)
2
3
4
6 Module::Install::FAQ - Frequently Asked Questions for Module::Install
7
9 Though Module::Install itself has a general FAQ section in the pod,
10 it's more for advocacy. Here's an incomplete and growing list of the
11 actual questions I have been frequently asked (or found on the net)
12 about Module::Install.
13
14 Do I also have to update my CPAN modules every time Module::Install is
15 updated?
16 The point of Module::Install is let module authors take care of
17 everything related to updating toolchains for the sake of module users.
18 So, if you choose to use Module::Install, it's you who should update
19 toolchains, i.e. Module::Install and other bundled modules. You should
20 check if there's any significant change/fix in your toolchains. You
21 should check if your toolchains go along with other tools users use to
22 install your distributions, or with the systems users are in, or
23 whatever that matters. In the end, you are expected to have much more
24 knowledge and willingness than average users.
25
26 That being said, practically, you don't have to update your
27 distributions if they are working well. But if you do find issues,
28 please update your distributions, even when you have nothing to change
29 in your own modules. Module::Install is not only a tool to write
30 better, but also a tool to encourage you to help others.
31
32 Do I really have to avoid auto_install()?
33 Not at all, using auto_install() is just fine. While it indeed behaved
34 erratically in older Module::Install versions, there have been no
35 reported issues since mid-2009. As far as compatibility with various
36 CPAN clients: several rather large projects on CPAN (including Catalyst
37 and DBIx::Class), are using "auto_install" without any issues reported
38 by their substantial userbases.
39
40 That said, if all you want to do is make it easy for a contributor to
41 checkout your code and quickly install necessary dependencies, there
42 are alternatives to "auto_install".
43
44 If your CPAN module is new enough, you can pass a dot to the cpan
45 command it provides, and it will install all the required distributions
46 from the CPAN:
47
48 $ cpan .
49
50 The same is true for the cpanm command from App::cpanminus, with which
51 you even can write like "cpanm --installdeps ."
52
53 Should I put an "inc" directory Module::Install automatically creates into
54 a repository for my projects?
55 Depends. If the repository is private and only for you, you usually
56 don't want to put it in your repository to let you always use the
57 latest Module::Install you have (the "inc" directory is recreated each
58 time you run "perl Makefile.PL").
59
60 If not, but you alone are the release manager and know what you have to
61 do when you release, putting the "inc" directory into your repository
62 may help other casual contributors, especially if you use minor (or
63 private) non-core extensions in your Makefile.PL.
64
65 However, if you generously allow other people to release, or you're not
66 so familiar with how Module::Install works and don't know what you have
67 to do in the above situation, don't put it in the repository. It may be
68 the cause of troubles including a wrong version in the "META.yml".
69
70 If you feel sorry about the inconvenience for your fellow contributors,
71 you may want to add explicitly "use
72 Module::Install::<ExtensionYouWantToUse>;" after "use
73 inc::Module::Install;" in your Makefile.PL. It doesn't do any harm, and
74 it makes clear which extensions they need to install.
75
76 What're there in the "inc" directory?
77 Module::Install puts its components (sometimes with extra modules)
78 under the "inc" directory to be released with a distribution. Those
79 modules will not be installed into your system, unless explicitly
80 copied into somewhere. They are only used to help configuration, tests,
81 and/or installation.
82
83 If there's no "inc" directory, Module::Install will automatically
84 create it when you run "perl Makefile.PL". And if that happens, a
85 directory (as of this writing, ".author") will also be created under
86 the "inc" directory. If the ".author" directory exists, the "inc"
87 directory will be recreated each time you run "perl Makefile.PL" to
88 make sure everything you need is included and up-to-date. This
89 ".author" directory will not be included in a distribution.
90
91 "perl Makefile.PL" doesn't work or does a strange behavior for me. Why?
92 Module::Install uses an Autoloader magic to delegate command handling
93 to the extensions in the "inc" directory. This works while everything
94 is in order, but when it finds something it can't understands, it dies
95 with a compile error, or does what you don't expect.
96
97 To prevent the latter strange behavior, Module::Install 0.96 and above
98 dies when it tries to process unknown commands. In most cases (other
99 than typos), these unknown commands are from non-core extensions on the
100 CPAN, and they should hopefully have predictable names that you can
101 easily tell from which extension they come, though some may be a bit
102 hard to find.
103
104 If you are trying to contribute to some project, and having a trouble
105 to run "Makefile.PL", please contact the author of the project to learn
106 what you have to install. If the distribution is already on the CPAN,
107 you may also want to look into the MANIFEST file to see which
108 extensions are included in the "inc" directory before you ask.
109
110 This usually does not happen in the user land as distributions that use
111 Module::Install should have all the necessary extensions under the
112 "inc" directory. If this should happen, that's most probably because
113 the release manager shipped the distribution under a non-author mode.
114 Please contact the author to fix the issue.
115
116 Why can't I do <anything> with Module::Install that I can do with
117 ExtUtils::MakeMaker?
118 Module::Install is just a wrapper of ExtUtils::MakeMaker. You can do
119 almost everything you can do with ExtUtils::MakeMaker by passing
120 arbitrary attributes to ExtUtils::MakeMaker in the backend via
121 "makemaker_args" like this:
122
123 use inc::Module::Install;
124
125 all_from 'lib/Foo/Bar.pm';
126
127 makemaker_args(
128 dist => { PREOP => '...' },
129 PL_FILES => {'bin/foobar.PL' => 'bin/foobar'},
130 );
131 WriteAll;
132
133 However, by the singleton nature of Module::Install, it may fail to
134 process Makefile.PLs in subdirectories correctly now, and you may need
135 to override attributes explicitly in some cases where Module::Install
136 provides other default values than ExtUtils::MakeMaker does. Please see
137 also the ExtUtils::MakeMaker's pod for further instructions.
138
139 I added MyMakefile.PL to my distribution, but it doesn't work as I
140 expected. Why?
141 ExtUtils::MakeMaker (and Module::Build also) treats "*.PL" files in the
142 top level directory as something special to generate other files. So,
143 if you add something that has ".PL" extension like "MyMakefile.PL" in
144 the top level directory, it also runs automatically when you run
145 Makefile.PL.
146
147 If you don't like this behavior, use "makemaker_args" to pass an
148 anonymous hash to "PL_FILES".
149
150 makemaker_args(PL_FILES => {});
151
153 Kenichi Ishigaki <ishigaki@cpan.org>
154
156 Copyright 2010 Kenichi Ishigaki.
157
158 This program is free software; you can redistribute it and/or modify it
159 under the same terms as Perl itself.
160
161
162
163perl v5.38.0 2023-07-20 Module::Install::FAQ(3)