3 Module::Build::API - API Reference for Module Authors
5 =for :stopwords apache bsd distdir distsign gpl installdirs lgpl mit mozilla packlists
9 I list here some of the most important methods in C<Module::Build>.
10 Normally you won't need to deal with these methods unless you want to
11 subclass C<Module::Build>. But since one of the reasons I created
12 this module in the first place was so that subclassing is possible
13 (and easy), I will certainly write more docs as the interface
25 This method returns a reasonable facsimile of the currently-executing
26 C<Module::Build> object representing the current build. You can use
27 this object to query its L</notes()> method, inquire about installed
28 modules, and so on. This is a great way to share information between
29 different parts of your build process. For instance, you can ask
30 the user a question during C<perl Build.PL>, then use their answer
31 during a regression test:
34 my $color = $build->prompt("What is your favorite color?");
35 $build->notes(color => $color);
39 my $build = Module::Build->current;
40 my $color = $build->notes('color');
43 The way the C<current()> method is currently implemented, there may be
44 slight differences between the C<$build> object in Build.PL and the
45 one in C<t/colortest.t>. It is our goal to minimize these differences
46 in future releases of Module::Build, so please report any anomalies
49 One important caveat: in its current implementation, C<current()> will
50 B<NOT> work correctly if you have changed out of the directory that
51 C<Module::Build> was invoked from.
57 Creates a new Module::Build object. Arguments to the new() method are
58 listed below. Most arguments are optional, but you must provide
59 either the L</module_name> argument, or L</dist_name> and one of
60 L</dist_version> or L</dist_version_from>. In other words, you must
61 provide enough information to determine both a distribution name and
71 An array reference of files to be cleaned up when the C<clean> action
72 is performed. See also the L<add_to_cleanup()|/"add_to_cleanup(@files)">
75 =item auto_configure_requires
79 This parameter determines whether Module::Build will add itself
80 automatically to configure_requires (and build_requires) if Module::Build
81 is not already there. The required version will be the last 'major' release,
82 as defined by the decimal version truncated to two decimal places (e.g. 0.34,
83 instead of 0.3402). The default value is true.
89 This parameter supports the setting of features (see
90 L</feature($name)>) automatically based on a set of prerequisites. For
91 instance, for a module that could optionally use either MySQL or
92 PostgreSQL databases, you might use C<auto_features> like this:
94 my $build = Module::Build->new
96 ...other stuff here...
99 description => "Interface with Postgres databases",
100 requires => { 'DBD::Pg' => 23.3,
101 'DateTime::Format::Pg' => 0 },
104 description => "Interface with MySQL databases",
105 requires => { 'DBD::mysql' => 17.9,
106 'DateTime::Format::MySQL' => 0 },
111 For each feature named, the required prerequisites will be checked, and
112 if there are no failures, the feature will be enabled (set to C<1>).
113 Otherwise the failures will be displayed to the user and the feature
114 will be disabled (set to C<0>).
116 See the documentation for L</requires> for the details of how
117 requirements can be specified.
123 An optional C<autosplit> argument specifies a file which should be run
124 through the L<AutoSplit::autosplit()|AutoSplit/autosplit> function.
125 If multiple files should be split, the argument may be given as an
126 array of the files to split.
128 In general I don't consider autosplitting a great idea, because it's
129 not always clear that autosplitting achieves its intended performance
130 benefits. It may even harm performance in environments like mod_perl,
131 where as much as possible of a module's code should be loaded during
138 The Module::Build class or subclass to use in the build script.
139 Defaults to "Module::Build" or the class name passed to or created by
140 a call to L</subclass()>. This property is useful if you're
141 writing a custom Module::Build subclass and have a bootstrapping
142 problem--that is, your subclass requires modules that may not be
143 installed when C<perl Build.PL> is executed, but you've listed in
144 L</build_requires> so that they should be available when C<./Build> is
151 Modules listed in this section are necessary to build and install the
152 given module, but are not necessary for regular usage of it. This is
153 actually an important distinction - it allows for tighter control over
154 the body of installed modules, and facilitates correct dependency
155 checking on binary/packaged distributions of the module.
157 See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
158 for the details of how requirements can be specified.
160 =item create_packlist
164 If true, this parameter tells Module::Build to create a F<.packlist>
165 file during the C<install> action, just like C<ExtUtils::MakeMaker> does.
166 The file is created in a subdirectory of the C<arch> installation
167 location. It is used by some other tools (CPAN, CPANPLUS, etc.) for
168 determining what files are part of an install.
170 The default value is true. This parameter was introduced in
171 Module::Build version 0.2609; previously no packlists were ever
172 created by Module::Build.
178 An optional C<c_source> argument specifies a directory which contains
179 C source files that the rest of the build may depend on. Any C<.c>
180 files in the directory will be compiled to object files. The
181 directory will be added to the search path during the compilation and
182 linking phases of any C or XS files.
186 A list of directories can be supplied using an anonymous array
187 reference of strings.
193 Modules listed in this section conflict in some serious way with the
194 given module. C<Module::Build> (or some higher-level tool) will
195 refuse to install the given module if the given module/version is also
198 See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
199 for the details of how requirements can be specified.
205 This parameter tells Module::Build to automatically create a
206 F<LICENSE> file at the top level of your distribution, containing the
207 full text of the author's chosen license. This requires
208 C<Software::License> on the author's machine, and further requires
209 that the C<license> parameter specifies a license that it knows about.
211 =item create_makefile_pl
215 This parameter lets you use C<Module::Build::Compat> during the
216 C<distdir> (or C<dist>) action to automatically create a Makefile.PL
217 for compatibility with C<ExtUtils::MakeMaker>. The parameter's value
218 should be one of the styles named in the L<Module::Build::Compat>
225 This parameter tells Module::Build to automatically create a F<README>
226 file at the top level of your distribution. Currently it will simply
227 use C<Pod::Text> (or C<Pod::Readme> if it's installed) on the file
228 indicated by C<dist_version_from> and put the result in the F<README>
229 file. This is by no means the only recommended style for writing a
230 F<README>, but it seems to be one common one used on the CPAN.
232 If you generate a F<README> in this way, it's probably a good idea to
233 create a separate F<INSTALL> file if that information isn't in the
240 This should be a short description of the distribution. This is used when
241 generating metadata for F<META.yml> and PPD files. If it is not given
242 then C<Module::Build> looks in the POD of the module from which it gets
243 the distribution's version. If it finds a POD section marked "=head1
244 NAME", then it looks for the first line matching C<\s+-\s+(.+)>,
245 and uses the captured text as the abstract.
251 This should be something like "John Doe <jdoe@example.com>", or if
252 there are multiple authors, an anonymous array of strings may be
253 specified. This is used when generating metadata for F<META.yml> and
254 PPD files. If this is not specified, then C<Module::Build> looks at
255 the module from which it gets the distribution's version. If it finds
256 a POD section marked "=head1 AUTHOR", then it uses the contents of
263 Specifies the name for this distribution. Most authors won't need to
264 set this directly, they can use C<module_name> to set C<dist_name> to
265 a reasonable default. However, some agglomerative distributions like
266 C<libwww-perl> or C<bioperl> have names that don't correspond directly
267 to a module name, so C<dist_name> can be set independently.
273 Specifies a version number for the distribution. See L</module_name>
274 or L</dist_version_from> for ways to have this set automatically from a
275 C<$VERSION> variable in a module. One way or another, a version
276 number needs to be set.
278 =item dist_version_from
282 Specifies a file to look for the distribution version in. Most
283 authors won't need to set this directly, they can use L</module_name>
284 to set it to a reasonable default.
286 The version is extracted from the specified file according to the same
287 rules as L<ExtUtils::MakeMaker> and C<CPAN.pm>. It involves finding
288 the first line that matches the regular expression
290 /([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
292 eval()-ing that line, then checking the value of the C<$VERSION>
293 variable. Quite ugly, really, but all the modules on CPAN depend on
294 this process, so there's no real opportunity to change to something
297 If the target file of L</dist_version_from> contains more than one package
298 declaration, the version returned will be the one matching the configured
305 A boolean flag indicating whether the F<Build.PL> file must be
306 executed, or whether this module can be built, tested and installed
307 solely from consulting its metadata file. The main reason to set this
308 to a true value is that your module performs some dynamic
309 configuration as part of its build/install process. If the flag is
310 omitted, the F<META.yml> spec says that installation tools should
311 treat it as 1 (true), because this is a safer way to behave.
313 Currently C<Module::Build> doesn't actually do anything with this flag
314 - it's up to higher-level tools like C<CPAN.pm> to do something useful
315 with it. It can potentially bring lots of security, packaging, and
316 convenience improvements.
318 =item extra_compiler_flags
320 =item extra_linker_flags
324 These parameters can contain array references (or strings, in which
325 case they will be split into arrays) to pass through to the compiler
326 and linker phases when compiling/linking C code. For example, to tell
327 the compiler that your code is C++, you might do:
329 my $build = Module::Build->new
331 module_name => 'Foo::Bar',
332 extra_compiler_flags => ['-x', 'c++'],
335 To link your XS code against glib you might write something like:
337 my $build = Module::Build->new
339 module_name => 'Foo::Bar',
341 extra_compiler_flags => scalar `glib-config --cflags`,
342 extra_linker_flags => scalar `glib-config --libs`,
349 You can pass arbitrary command line options to F<Build.PL> or
350 F<Build>, and they will be stored in the Module::Build object and can
351 be accessed via the L</args()> method. However, sometimes you want
352 more flexibility out of your argument processing than this allows. In
353 such cases, use the C<get_options> parameter to pass in a hash
354 reference of argument specifications, and the list of arguments to
355 F<Build.PL> or F<Build> will be processed according to those
356 specifications before they're passed on to C<Module::Build>'s own
359 The supported option specification hash keys are:
366 The type of option. The types are those supported by Getopt::Long; consult
367 its documentation for a complete list. Typical types are C<=s> for strings,
368 C<+> for additive options, and C<!> for negatable options. If the
369 type is not specified, it will be considered a boolean, i.e. no
370 argument is taken and a value of 1 will be assigned when the option is
375 A reference to a scalar in which to store the value passed to the option.
376 If not specified, the value will be stored under the option name in the
377 hash returned by the C<args()> method.
381 A default value for the option. If no default value is specified and no option
382 is passed, then the option key will not exist in the hash returned by
388 You can combine references to your own variables or subroutines with
389 unreferenced specifications, for which the result will also be stored in the
390 hash returned by C<args()>. For example:
393 my $build = Module::Build->new
395 module_name => 'Foo::Bar',
397 Loud => { store => \$loud },
398 Dbd => { type => '=s' },
399 Quantity => { type => '+' },
403 print STDERR "HEY, ARE YOU LISTENING??\n" if $loud;
404 print "We'll use the ", $build->args('Dbd'), " DBI driver\n";
405 print "Are you sure you want that many?\n"
406 if $build->args('Quantity') > 2;
408 The arguments for such a specification can be called like so:
410 perl Build.PL --Loud --Dbd=DBD::pg --Quantity --Quantity --Quantity
412 B<WARNING:> Any option specifications that conflict with Module::Build's own
413 options (defined by its properties) will throw an exception. Use capitalized
414 option names to avoid unintended conflicts with future Module::Build options.
416 Consult the Getopt::Long documentation for details on its usage.
422 Specifies any additional directories in which to search for C header
423 files. May be given as a string indicating a single directory, or as
424 a list reference indicating multiple directories.
430 You can set paths for individual installable elements by using the
431 C<install_path> parameter:
433 my $build = Module::Build->new
435 ...other stuff here...
438 arch => '/foo/lib/arch',
446 Determines where files are installed within the normal perl hierarchy
447 as determined by F<Config.pm>. Valid values are: C<core>, C<site>,
448 C<vendor>. The default is C<site>. See
449 L<Module::Build/"INSTALL PATHS">
455 Specifies the licensing terms of your distribution. Valid options include:
462 The distribution is licensed under the Apache License, Version 2.0
463 (L<http://apache.org/licenses/LICENSE-2.0>).
467 The distribution is licensed under the Apache Software License, Version 1.1
468 (L<http://apache.org/licenses/LICENSE-1.1>).
472 The distribution is licensed under the Artistic License, as specified
473 by the F<Artistic> file in the standard Perl distribution.
477 The distribution is licensed under the Artistic 2.0 License
478 (L<http://opensource.org/licenses/artistic-license-2.0.php>.)
482 The distribution is licensed under the BSD License
483 (L<http://www.opensource.org/licenses/bsd-license.php>).
487 The distribution is licensed under the terms of the GNU General
488 Public License (L<http://www.opensource.org/licenses/gpl-license.php>).
492 The distribution is licensed under the terms of the GNU Lesser
493 General Public License
494 (L<http://www.opensource.org/licenses/lgpl-license.php>).
498 The distribution is licensed under the MIT License
499 (L<http://opensource.org/licenses/mit-license.php>).
503 The distribution is licensed under the Mozilla Public
504 License. (L<http://opensource.org/licenses/mozilla1.0.php> or
505 L<http://opensource.org/licenses/mozilla1.1.php>)
509 The distribution is licensed under some other Open Source
510 Initiative-approved license listed at
511 L<http://www.opensource.org/licenses/>.
515 The distribution may be copied and redistributed under the same terms
516 as Perl itself (this is by far the most common licensing option for
517 modules on CPAN). This is a dual license, in which the user may
518 choose between either the GPL or the Artistic license.
522 The distribution may not be redistributed without special permission
523 from the author and/or copyright holder.
527 The distribution is licensed under a license that is B<not> approved
528 by www.opensource.org but that allows distribution without
534 Note that you must still include the terms of your license in your
535 documentation - this field only lets automated tools figure out your
536 licensing restrictions. Humans still need something to read. If you
537 choose to provide this field, you should make sure that you keep it in
538 sync with your written documentation if you ever change your licensing
541 You may also use a license type of C<unknown> if you don't wish to
542 specify your terms in the metadata.
544 It is a fatal error to use a license other than the ones mentioned
545 above. This is not because I wish to impose licensing terms on you -
546 please let me know if you would like another license option to be
547 added to the list. I just started out with a small set of licenses to
548 keep things simple, figuring I'd let people with actual working
549 knowledge in this area tell me what to do. So if that's you, drop me
556 A hash of key/value pairs that should be added to the F<META.yml> file
557 during the C<distmeta> action. Any existing entries with the same
558 names will be overridden.
560 See the L</"MODULE METADATA"> section for details.
566 A hash of key/value pairs that should be merged into the F<META.yml>
567 file during the C<distmeta> action. Any existing entries with the
568 same names will be overridden.
570 The only difference between C<meta_add> and C<meta_merge> is their
571 behavior on hash-valued and array-valued entries: C<meta_add> will
572 completely blow away the existing hash or array value, but
573 C<meta_merge> will merge the supplied data into the existing hash or
576 See the L</"MODULE METADATA"> section for details.
582 The C<module_name> is a shortcut for setting default values of
583 C<dist_name> and C<dist_version_from>, reflecting the fact that the
584 majority of CPAN distributions are centered around one "main" module.
585 For instance, if you set C<module_name> to C<Foo::Bar>, then
586 C<dist_name> will default to C<Foo-Bar> and C<dist_version_from> will
587 default to C<lib/Foo/Bar.pm>. C<dist_version_from> will in turn be
588 used to set C<dist_version>.
590 Setting C<module_name> won't override a C<dist_*> parameter you
597 The C<needs_compiler> parameter indicates whether a compiler is required to
598 build the distsribution. The default is false, unless XS files are found or
599 the C<c_source> parameter is set, in which case it is true. If true,
600 L<ExtUtils::CBuilder> is automatically added to C<build_requires> if needed.
602 For a distribution where a compiler is I<optional>, e.g. a dual XS/pure-Perl
603 distribution, C<needs_compiler> should explicitly be set to a false value.
609 An optional parameter specifying a set of C<.PL> files in your
610 distribution. These will be run as Perl scripts prior to processing
611 the rest of the files in your distribution with the name of the file
612 they're generating as an argument. They are usually used as templates
613 for creating other files dynamically, so that a file like
614 C<lib/Foo/Bar.pm.PL> might create the file C<lib/Foo/Bar.pm>.
616 The files are specified with the C<.PL> files as hash keys, and the
617 file(s) they generate as hash values, like so:
619 my $build = Module::Build->new
621 module_name => 'Foo::Bar',
623 PL_files => { 'lib/Foo/Bar.pm.PL' => 'lib/Foo/Bar.pm' },
626 Note that the path specifications are I<always> given in Unix-like
627 format, not in the style of the local system.
629 If your C<.PL> scripts don't create any files, or if they create files
630 with unexpected names, or even if they create multiple files, you can
631 indicate that so that Module::Build can properly handle these created
635 'lib/Foo/Bar.pm.PL' => 'lib/Foo/Bar.pm',
636 'lib/something.PL' => ['/lib/something', '/lib/else'],
637 'lib/funny.PL' => [],
640 Here's an example of a simple PL file.
642 my $output_file = shift;
643 open my $fh, ">", $output_file or die "Can't open $output_file: $!";
648 print "Hello, world!\n";
651 PL files are not installed by default, so its safe to put them in
659 An optional parameter specifying the set of C<.pm> files in this
660 distribution, specified as a hash reference whose keys are the files'
661 locations in the distributions, and whose values are their logical
662 locations based on their package name, i.e. where they would be found
663 in a "normal" Module::Build-style distribution. This parameter is
664 mainly intended to support alternative layouts of files.
666 For instance, if you have an old-style C<MakeMaker> distribution for a
667 module called C<Foo::Bar> and a F<Bar.pm> file at the top level of the
668 distribution, you could specify your layout in your C<Build.PL> like
671 my $build = Module::Build->new
673 module_name => 'Foo::Bar',
675 pm_files => { 'Bar.pm' => 'lib/Foo/Bar.pm' },
678 Note that the values should include C<lib/>, because this is where
679 they would be found in a "normal" Module::Build-style distribution.
681 Note also that the path specifications are I<always> given in
682 Unix-like format, not in the style of the local system.
688 Just like C<pm_files>, but used for specifying the set of C<.pod>
689 files in your distribution.
695 This is just like the L</requires> argument, except that modules listed
696 in this section aren't essential, just a good idea. We'll just print
697 a friendly warning if one of these modules aren't found, but we'll
700 If a module is recommended but not required, all tests should still
701 pass if the module isn't installed. This may mean that some tests
702 may be skipped if recommended dependencies aren't present.
704 Automated tools like CPAN.pm should inform the user when recommended
705 modules aren't installed, and it should offer to install them if it
708 See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
709 for the details of how requirements can be specified.
711 =item recursive_test_files
715 Normally, C<Module::Build> does not search subdirectories when looking
716 for tests to run. When this options is set it will search recursively
717 in all subdirectories of the standard 't' test directory.
723 An optional C<requires> argument specifies any module prerequisites
724 that the current module depends on.
726 One note: currently C<Module::Build> doesn't actually I<require> the
727 user to have dependencies installed, it just strongly urges. In the
728 future we may require it. There's also a L</recommends> section for
729 things that aren't absolutely required.
731 Automated tools like CPAN.pm should refuse to install a module if one
732 of its dependencies isn't satisfied, unless a "force" command is given
733 by the user. If the tools are helpful, they should also offer to
734 install the dependencies.
736 A synonym for C<requires> is C<prereq>, to help succour people
737 transitioning from C<ExtUtils::MakeMaker>. The C<requires> term is
738 preferred, but the C<prereq> term will remain valid in future
741 See the documentation for L<Module::Build::Authoring/"PREREQUISITES">
742 for the details of how requirements can be specified.
748 An optional parameter specifying a set of files that should be
749 installed as executable Perl scripts when the module is installed.
750 May be given as an array reference of the files, as a hash reference
751 whose keys are the files (and whose values will currently be ignored),
752 as a string giving the name of a directory in which to find scripts,
753 or as a string giving the name of a single script file.
755 The default is to install any scripts found in a F<bin> directory at
756 the top level of the distribution, minus any keys of L<PL_files>.
758 For backward compatibility, you may use the parameter C<scripts>
759 instead of C<script_files>. Please consider this usage deprecated,
760 though it will continue to exist for several version releases.
766 An optional parameter specifying directories of static data files to
767 be installed as read-only files for use with L<File::ShareDir>. The
768 C<share_dir> property supports both distribution-level and
769 module-level share files.
771 The simplest use of C<share_dir> is to set it to a directory name or an
772 arrayref of directory names containing files to be installed in the
773 distribution-level share directory.
777 Alternatively, if C<share_dir> is a hashref, it may have C<dist> or
778 C<module> keys providing full flexibility in defining how share
779 directories should be installed.
782 dist => [ 'examples', 'more_examples' ],
784 Foo::Templates => ['share/html', 'share/text'],
785 Foo::Config => 'share/config',
789 If C<share_dir> is set, then File::ShareDir will automatically be added
790 to the C<requires> hash.
796 If a true value is specified for this parameter, L<Module::Signature>
797 will be used (via the 'distsign' action) to create a SIGNATURE file
798 for your distribution during the 'distdir' action, and to add the
799 SIGNATURE file to the MANIFEST (therefore, don't add it yourself).
801 The default value is false. In the future, the default may change to
802 true if you have C<Module::Signature> installed on your system.
808 An optional parameter specifying a set of files that should be used as
809 C<Test::Harness>-style regression tests to be run during the C<test>
810 action. May be given as an array reference of the files, or as a hash
811 reference whose keys are the files (and whose values will currently be
812 ignored). If the argument is given as a single string (not in an
813 array reference), that string will be treated as a C<glob()> pattern
814 specifying the files to use.
816 The default is to look for a F<test.pl> script in the top-level
817 directory of the distribution, and any files matching the glob pattern
818 C<*.t> in the F<t/> subdirectory. If the C<recursive_test_files>
819 property is true, then the C<t/> directory will be scanned recursively
822 =item use_tap_harness
826 An optional parameter indicating whether or not to use TAP::Harness for
827 testing rather than Test::Harness. Defaults to false. If set to true, you must
828 therefore be sure to add TAP::Harness as a requirement for your module in
829 L</build_requires>. Implicitly set to a true value if C<tap_harness_args> is
832 =item tap_harness_args
836 An optional parameter specifying parameters to be passed to TAP::Harness when
837 running tests. Must be given as a hash reference of parameters; see the
838 L<TAP::Harness|TAP::Harness> documentation for details. Note that specifying
839 this parameter will implicitly set C<use_tap_harness> to a true value. You
840 must therefore be sure to add TAP::Harness as a requirement for your module in
847 Just like C<pm_files>, but used for specifying the set of C<.xs>
848 files in your distribution.
853 =item new_from_context(%args)
857 When called from a directory containing a F<Build.PL> script (in other words,
858 the base directory of a distribution), this method will run the F<Build.PL> and
859 call C<resume()> to return the resulting C<Module::Build> object to the caller.
860 Any key-value arguments given to C<new_from_context()> are essentially like
861 command line arguments given to the F<Build.PL> script, so for example you
862 could pass C<< verbose => 1 >> to this method to turn on verbosity.
868 You'll probably never call this method directly, it's only called from the
869 auto-generated C<Build> script (and the C<new_from_context> method). The
870 C<new()> method is only called once, when the user runs C<perl Build.PL>.
871 Thereafter, when the user runs C<Build test> or another action, the
872 C<Module::Build> object is created using the C<resume()> method to
873 re-instantiate with the settings given earlier to C<new()>.
879 This creates a new C<Module::Build> subclass on the fly, as described
880 in the L<Module::Build::Authoring/"SUBCLASSING"> section. The caller
881 must provide either a C<class> or C<code> parameter, or both. The
882 C<class> parameter indicates the name to use for the new subclass, and
883 defaults to C<MyModuleBuilder>. The C<code> parameter specifies Perl
884 code to use as the body of the subclass.
891 use base 'Module::Build';
892 __PACKAGE__->add_property( 'pedantic' );
893 __PACKAGE__->add_property( answer => 42 );
894 __PACKAGE__->add_property(
896 default => sub { time },
899 shift->property_error( "'$_' is not an epoch time" );
904 Adds a property to a Module::Build class. Properties are those attributes of a
905 Module::Build object which can be passed to the constructor and which have
906 accessors to get and set them. All of the core properties, such as
907 C<module_name> and C<license>, are defined using this class method.
909 The first argument to C<add_property()> is always the name of the property.
910 The second argument can be either a default value for the property, or a list
911 of key/value pairs. The supported keys are:
917 The default value. May optionally be specified as a code reference, in which
918 case the return value from the execution of the code reference will be used.
919 If you need the default to be a code reference, just use a code reference to
922 default => sub { sub { ... } },
926 A code reference that checks that a value specified for the property is valid.
927 During the execution of the code reference, the new value will be included in
928 the C<$_> variable. If the value is correct, the C<check> code reference
929 should return true. If the value is not correct, it sends an error message to
930 C<property_error()> and returns false.
934 When this method is called, a new property will be installed in the
935 Module::Build class, and an accessor will be built to allow the property to be
936 get or set on the build object.
938 print $build->pedantic, $/;
941 If the default value is a hash reference, this generates a special-case
942 accessor method, wherein individual key/value pairs may be set or fetched:
944 print "stuff{foo} is: ", $build->stuff( 'foo' ), $/;
945 $build->stuff( foo => 'bar' );
946 print $build->stuff( 'foo' ), $/; # Outputs "bar"
948 Of course, you can still set the entire hash reference at once, as well:
950 $build->stuff( { foo => 'bar', baz => 'yo' } );
952 In either case, if a C<check> has been specified for the property, it will be
953 applied to the entire hash. So the check code reference should look something
957 return 1 if defined $_ && exists $_->{foo};
958 shift->property_error(qq{Property "stuff" needs "foo"});
973 =item add_build_element($type)
977 Adds a new type of entry to the build process. Accepts a single
978 string specifying its type-name. There must also be a method defined
979 to process things of that type, e.g. if you add a build element called
980 C<'foo'>, then you must also define a method called
981 C<process_foo_files()>.
984 L<Module::Build::Cookbook/"Adding new file types to the build process">.
986 =item add_to_cleanup(@files)
990 You may call C<< $self->add_to_cleanup(@patterns) >> to tell
991 C<Module::Build> that certain files should be removed when the user
992 performs the C<Build clean> action. The arguments to the method are
993 patterns suitable for passing to Perl's C<glob()> function, specified
994 in either Unix format or the current machine's native format. It's
995 usually convenient to use Unix format when you hard-code the filenames
996 (e.g. in F<Build.PL>) and the native format when the names are
997 programmatically generated (e.g. in a testing script).
999 I decided to provide a dynamic method of the C<$build> object, rather
1000 than just use a static list of files named in the F<Build.PL>, because
1001 these static lists can get difficult to manage. I usually prefer to
1002 keep the responsibility for registering temporary files close to the
1003 code that creates them.
1009 my $args_href = $build->args;
1010 my %args = $build->args;
1011 my $arg_value = $build->args($key);
1012 $build->args($key, $value);
1014 This method is the preferred interface for retrieving the arguments passed via
1015 command line options to F<Build.PL> or F<Build>, minus the Module-Build
1018 When called in in a scalar context with no arguments, this method returns a
1019 reference to the hash storing all of the arguments; in an array context, it
1020 returns the hash itself. When passed a single argument, it returns the value
1021 stored in the args hash for that option key. When called with two arguments,
1022 the second argument is assigned to the args hash under the key passed as the
1025 =item autosplit_file($from, $to)
1029 Invokes the L<AutoSplit> module on the C<$from> file, sending the
1030 output to the C<lib/auto> directory inside C<$to>. C<$to> is
1031 typically the C<blib/> directory.
1037 Returns a string containing the root-level directory of this build,
1038 i.e. where the C<Build.PL> script and the C<lib> directory can be
1039 found. This is usually the same as the current working directory,
1040 because the C<Build> script will C<chdir()> into this directory as
1041 soon as it begins execution.
1043 =item build_requires()
1047 Returns a hash reference indicating the C<build_requires>
1048 prerequisites that were passed to the C<new()> method.
1050 =item can_action( $action )
1052 Returns a reference to the method that defines C<$action>, or false
1053 otherwise. This is handy for actions defined (or maybe not!) in subclasses.
1061 Returns the internal ExtUtils::CBuilder object that can be used for
1062 compiling & linking C code. If no such object is available (e.g. if
1063 the system has no compiler installed) an exception will be thrown.
1065 =item check_installed_status($module, $version)
1069 This method returns a hash reference indicating whether a version
1070 dependency on a certain module is satisfied. The C<$module> argument
1071 is given as a string like C<"Data::Dumper"> or C<"perl">, and the
1072 C<$version> argument can take any of the forms described in L</requires>
1073 above. This allows very fine-grained version checking.
1075 The returned hash reference has the following structure:
1078 ok => $whether_the_dependency_is_satisfied,
1079 have => $version_already_installed,
1080 need => $version_requested, # Same as incoming $version argument
1081 message => $informative_error_message,
1084 If no version of C<$module> is currently installed, the C<have> value
1085 will be the string C<< "<none>" >>. Otherwise the C<have> value will
1086 simply be the version of the installed module. Note that this means
1087 that if C<$module> is installed but doesn't define a version number,
1088 the C<have> value will be C<undef> - this is why we don't use C<undef>
1089 for the case when C<$module> isn't installed at all.
1091 This method may be called either as an object method
1092 (C<< $build->check_installed_status($module, $version) >>)
1093 or as a class method
1094 (C<< Module::Build->check_installed_status($module, $version) >>).
1096 =item check_installed_version($module, $version)
1100 Like L<check_installed_status()|/"check_installed_status($module, $version)">,
1101 but simply returns true or false depending on whether module
1102 C<$module> satisfies the dependency C<$version>.
1104 If the check succeeds, the return value is the actual version of
1105 C<$module> installed on the system. This allows you to do the
1108 my $installed = $build->check_installed_version('DBI', '1.15');
1110 print "Congratulations, version $installed of DBI is installed.\n";
1112 die "Sorry, you must install DBI.\n";
1115 If the check fails, we return false and set C<$@> to an informative
1118 If C<$version> is any non-true value (notably zero) and any version of
1119 C<$module> is installed, we return true. In this case, if C<$module>
1120 doesn't define a version, or if its version is zero, we return the
1121 special value "0 but true", which is numerically zero, but logically
1124 In general you might prefer to use C<check_installed_status> if you
1125 need detailed information, or this method if you just need a yes/no
1128 =item compare_versions($v1, $op, $v2)
1132 Compares two module versions C<$v1> and C<$v2> using the operator
1133 C<$op>, which should be one of Perl's numeric operators like C<!=> or
1134 C<< >= >> or the like. We do at least a halfway-decent job of
1135 handling versions that aren't strictly numeric, like C<0.27_02>, but
1136 exotic stuff will likely cause problems.
1138 In the future, the guts of this method might be replaced with a call
1139 out to C<version.pm>.
1143 =item config($key, $value)
1145 =item config() [deprecated]
1149 With a single argument C<$key>, returns the value associated with that
1150 key in the C<Config.pm> hash, including any changes the author or user
1153 With C<$key> and C<$value> arguments, sets the value for future
1154 callers of C<config($key)>.
1156 With no arguments, returns a hash reference containing all such
1157 key-value pairs. This usage is deprecated, though, because it's a
1158 resource hog and violates encapsulation.
1160 =item config_data($name)
1162 =item config_data($name => $value)
1166 With a single argument, returns the value of the configuration
1167 variable C<$name>. With two arguments, sets the given configuration
1168 variable to the given value. The value may be any Perl scalar that's
1169 serializable with C<Data::Dumper>. For instance, if you write a
1170 module that can use a MySQL or PostgreSQL back-end, you might create
1171 configuration variables called C<mysql_connect> and
1172 C<postgres_connect>, and set each to an array of connection parameters
1173 for C<< DBI->connect() >>.
1175 Configuration values set in this way using the Module::Build object
1176 will be available for querying during the build/test process and after
1177 installation via the generated C<...::ConfigData> module, as
1178 C<< ...::ConfigData->config($name) >>.
1180 The L<feature()|/"feature($name)"> and C<config_data()> methods represent
1181 Module::Build's main support for configuration of installed modules.
1182 See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">.
1188 Returns a hash reference indicating the C<conflicts> prerequisites
1189 that were passed to the C<new()> method.
1191 =item contains_pod($file) [deprecated]
1195 [Deprecated] Please see L<Module::Build::ModuleInfo> instead.
1197 Returns true if the given file appears to contain POD documentation.
1198 Currently this checks whether the file has a line beginning with
1199 '=pod', '=head', or '=item', but the exact semantics may change in the
1202 =item copy_if_modified(%parameters)
1206 Takes the file in the C<from> parameter and copies it to the file in
1207 the C<to> parameter, or the directory in the C<to_dir> parameter, if
1208 the file has changed since it was last copied (or if it doesn't exist
1209 in the new location). By default the entire directory structure of
1210 C<from> will be copied into C<to_dir>; an optional C<flatten>
1211 parameter will copy into C<to_dir> without doing so.
1213 Returns the path to the destination file, or C<undef> if nothing
1214 needed to be copied.
1216 Any directories that need to be created in order to perform the
1217 copying will be automatically created.
1219 The destination file is set to read-only. If the source file has the
1220 executable bit set, then the destination file will be made executable.
1222 =item create_build_script()
1226 Creates an executable script called C<Build> in the current directory
1227 that will be used to execute further user actions. This script is
1228 roughly analogous (in function, not in form) to the Makefile created
1229 by C<ExtUtils::MakeMaker>. This method also creates some temporary
1230 data in a directory called C<_build/>. Both of these will be removed
1231 when the C<realclean> action is performed.
1233 Among the files created in C<_build/> is a F<_build/prereqs> file
1234 containing the set of prerequisites for this distribution, as a hash
1235 of hashes. This file may be C<eval()>-ed to obtain the authoritative
1236 set of prerequisites, which might be different from the contents of
1237 F<META.yml> (because F<Build.PL> might have set them dynamically).
1238 But fancy developers take heed: do not put any fancy custom runtime
1239 code in the F<_build/prereqs> file, leave it as a static declaration
1240 containing only strings and numbers. Similarly, do not alter the
1241 structure of the internal C<< $self->{properties}{requires} >> (etc.)
1242 data members, because that's where this data comes from.
1244 =item current_action()
1248 Returns the name of the currently-running action, such as "build" or
1249 "test". This action is not necessarily the action that was originally
1250 invoked by the user. For example, if the user invoked the "test"
1251 action, current_action() would initially return "test". However,
1252 action "test" depends on action "code", so current_action() will
1253 return "code" while that dependency is being executed. Once that
1254 action has completed, current_action() will again return "test".
1256 If you need to know the name of the original action invoked by the
1257 user, see L</invoked_action()> below.
1259 =item depends_on(@actions)
1263 Invokes the named action or list of actions in sequence. Using this
1264 method is preferred to calling the action explicitly because it
1265 performs some internal record-keeping, and it ensures that the same
1266 action is not invoked multiple times (note: in future versions of
1267 Module::Build it's conceivable that this run-only-once mechanism will
1268 be changed to something more intelligent).
1270 Note that the name of this method is something of a misnomer; it
1271 should really be called something like
1272 C<invoke_actions_unless_already_invoked()> or something, but for
1273 better or worse (perhaps better!) we were still thinking in
1274 C<make>-like dependency terms when we created this method.
1276 See also L<dispatch()|/"dispatch($action, %args)">. The main
1277 distinction between the two is that C<depends_on()> is meant to call
1278 an action from inside another action, whereas C<dispatch()> is meant
1279 to set the very top action in motion.
1281 =item dir_contains($first_dir, $second_dir)
1285 Returns true if the first directory logically contains the second
1286 directory. This is just a convenience function because C<File::Spec>
1287 doesn't really provide an easy way to figure this out (but
1288 C<Path::Class> does...).
1290 =item dispatch($action, %args)
1294 Invokes the build action C<$action>. Optionally, a list of options
1295 and their values can be passed in. This is equivalent to invoking an
1296 action at the command line, passing in a list of options.
1298 Custom options that have not been registered must be passed in as a
1299 hash reference in a key named "args":
1301 $build->dispatch('foo', verbose => 1, args => { my_option => 'value' });
1303 This method is intended to be used to programmatically invoke build
1304 actions, e.g. by applications controlling Module::Build-based builds
1305 rather than by subclasses.
1307 See also L<depends_on()|/"depends_on(@actions)">. The main
1308 distinction between the two is that C<depends_on()> is meant to call
1309 an action from inside another action, whereas C<dispatch()> is meant
1310 to set the very top action in motion.
1316 Returns the name of the directory that will be created during the
1317 C<dist> action. The name is derived from the C<dist_name> and
1318 C<dist_version> properties.
1324 Returns the name of the current distribution, as passed to the
1325 C<new()> method in a C<dist_name> or modified C<module_name>
1328 =item dist_version()
1332 Returns the version of the current distribution, as determined by the
1333 C<new()> method from a C<dist_version>, C<dist_version_from>, or
1334 C<module_name> parameter.
1336 =item do_system($cmd, @args)
1340 This is a fairly simple wrapper around Perl's C<system()> built-in
1341 command. Given a command and an array of optional arguments, this
1342 method will print the command to C<STDOUT>, and then execute it using
1343 Perl's C<system()>. It returns true or false to indicate success or
1344 failure (the opposite of how C<system()> works, but more intuitive).
1346 Note that if you supply a single argument to C<do_system()>, it
1347 will/may be processed by the system's shell, and any special
1348 characters will do their special things. If you supply multiple
1349 arguments, no shell will get involved and the command will be executed
1352 =item feature($name)
1354 =item feature($name => $value)
1358 With a single argument, returns true if the given feature is set.
1359 With two arguments, sets the given feature to the given boolean value.
1360 In this context, a "feature" is any optional functionality of an
1361 installed module. For instance, if you write a module that could
1362 optionally support a MySQL or PostgreSQL backend, you might create
1363 features called C<mysql_support> and C<postgres_support>, and set them
1364 to true/false depending on whether the user has the proper databases
1365 installed and configured.
1367 Features set in this way using the Module::Build object will be
1368 available for querying during the build/test process and after
1369 installation via the generated C<...::ConfigData> module, as
1370 C<< ...::ConfigData->feature($name) >>.
1372 The C<feature()> and C<config_data()> methods represent
1373 Module::Build's main support for configuration of installed modules.
1374 See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">.
1376 =item fix_shebang_line(@files)
1380 Modify any "shebang" line in the specified files to use the path to the
1381 perl executable being used for the current build. Files are modified
1382 in-place. The existing shebang line must have a command that contains
1383 "C<perl>"; arguments to the command do not count. In particular, this
1384 means that the use of C<#!/usr/bin/env perl> will not be changed.
1386 For an explanation of shebang lines, see
1387 L<http://en.wikipedia.org/wiki/Shebang_%28Unix%29>.
1389 =item have_c_compiler()
1393 Returns true if the current system seems to have a working C compiler.
1394 We currently determine this by attempting to compile a simple C source
1395 file and reporting whether the attempt was successful.
1397 =item install_base_relpaths()
1399 =item install_base_relpaths($type)
1401 =item install_base_relpaths($type => $path)
1405 Set or retrieve the relative paths that are appended to
1406 C<install_base> for any installable element. This is useful if you
1407 want to set the relative install path for custom build elements.
1409 With no argument, it returns a reference to a hash containing all
1410 elements and their respective values. This hash should not be modified
1411 directly; use the multiple argument below form to change values.
1413 The single argument form returns the value associated with the
1416 The multiple argument form allows you to set the paths for element types.
1417 C<$value> must be a relative path using Unix-like paths. (A series of
1418 directories separated by slashes, e.g. C<foo/bar>.) The return value is a
1419 localized path based on C<$value>.
1421 Assigning the value C<undef> to an element causes it to be removed.
1423 =item install_destination($type)
1427 Returns the directory in which items of type C<$type> (e.g. C<lib>,
1428 C<arch>, C<bin>, or anything else returned by the L</install_types()>
1429 method) will be installed during the C<install> action. Any settings
1430 for C<install_path>, C<install_base>, and C<prefix> are taken into
1431 account when determining the return value.
1433 =item install_path()
1435 =item install_path($type)
1437 =item install_path($type => $path)
1441 Set or retrieve paths for specific installable elements. This is
1442 useful when you want to examine any explicit install paths specified
1443 by the user on the command line, or if you want to set the install
1444 path for a specific installable element based on another attribute
1445 like C<install_base()>.
1447 With no argument, it returns a reference to a hash containing all
1448 elements and their respective values. This hash should not be modified
1449 directly; use the multiple argument below form to change values.
1451 The single argument form returns the value associated with the
1454 The multiple argument form allows you to set the paths for element types.
1455 The supplied C<$path> should be an absolute path to install elements
1456 of C<$type>. The return value is C<$path>.
1458 Assigning the value C<undef> to an element causes it to be removed.
1460 =item install_types()
1464 Returns a list of installable types that this build knows about.
1465 These types each correspond to the name of a directory in F<blib/>,
1466 and the list usually includes items such as C<lib>, C<arch>, C<bin>,
1467 C<script>, C<libdoc>, C<bindoc>, and if HTML documentation is to be
1468 built, C<libhtml> and C<binhtml>. Other user-defined types may also
1471 =item invoked_action()
1475 This is the name of the original action invoked by the user. This
1476 value is set when the user invokes F<Build.PL>, the F<Build> script,
1477 or programmatically through the L<dispatch()|/"dispatch($action, %args)">
1478 method. It does not change as sub-actions are executed as
1479 dependencies are evaluated.
1481 To get the name of the currently executing dependency, see
1482 L</current_action()> above.
1488 =item notes($key => $value)
1492 The C<notes()> value allows you to store your own persistent
1493 information about the build, and to share that information among
1494 different entities involved in the build. See the example in the
1495 C<current()> method.
1497 The C<notes()> method is essentially a glorified hash access. With no
1498 arguments, C<notes()> returns the entire hash of notes. With one argument,
1499 C<notes($key)> returns the value associated with the given key. With two
1500 arguments, C<notes($key, $value)> sets the value associated with the given key
1501 to C<$value> and returns the new value.
1503 The lifetime of the C<notes> data is for "a build" - that is, the
1504 C<notes> hash is created when C<perl Build.PL> is run (or when the
1505 C<new()> method is run, if the Module::Build Perl API is being used
1506 instead of called from a shell), and lasts until C<perl Build.PL> is
1507 run again or the C<clean> action is run.
1513 Returns a string containing the working directory that was in effect
1514 before the F<Build> script chdir()-ed into the C<base_dir>. This
1515 might be useful for writing wrapper tools that might need to chdir()
1522 If you're subclassing Module::Build and some code needs to alter its
1523 behavior based on the current platform, you may only need to know
1524 whether you're running on Windows, Unix, MacOS, VMS, etc., and not the
1525 fine-grained value of Perl's C<$^O> variable. The C<os_type()> method
1526 will return a string like C<Windows>, C<Unix>, C<MacOS>, C<VMS>, or
1527 whatever is appropriate. If you're running on an unknown platform, it
1528 will return C<undef> - there shouldn't be many unknown platforms
1533 =item is_windowsish()
1537 Convenience functions that return a boolean value indicating whether
1538 this platform behaves respectively like VMS, Windows, or Unix. For
1539 arbitrary reasons other platforms don't get their own such functions,
1543 =item prefix_relpaths()
1545 =item prefix_relpaths($installdirs)
1547 =item prefix_relpaths($installdirs, $type)
1549 =item prefix_relpaths($installdirs, $type => $path)
1553 Set or retrieve the relative paths that are appended to C<prefix> for
1554 any installable element. This is useful if you want to set the
1555 relative install path for custom build elements.
1557 With no argument, it returns a reference to a hash containing all
1558 elements and their respective values as defined by the current
1559 C<installdirs> setting.
1561 With a single argument, it returns a reference to a hash containing
1562 all elements and their respective values as defined by
1565 The hash returned by the above calls should not be modified directly;
1566 use the three-argument below form to change values.
1568 The two argument form returns the value associated with the
1571 The multiple argument form allows you to set the paths for element types.
1572 C<$value> must be a relative path using Unix-like paths. (A series of
1573 directories separated by slashes, e.g. C<foo/bar>.) The return value is a
1574 localized path based on C<$value>.
1576 Assigning the value C<undef> to an element causes it to be removed.
1578 =item get_metadata()
1582 This method returns a hash reference of metadata that can be used to create a
1583 YAML datastream. It is provided for authors to override or customize the fields
1584 of F<META.yml>. E.g.
1586 package My::Builder;
1587 use base 'Module::Build';
1590 my $self, @args = @_;
1591 my $data = $self->SUPER::get_metadata(@args);
1592 $data->{custom_field} = 'foo';
1596 The only valid argument is C<fatal>, which indicates whether missing required
1597 metadata fields should be a fatal error or not. For META creation, it
1598 generally should, but for MYMETA creation for end-users, it should not be
1601 This method is a wrapper around the old prepare_metadata API now that we
1602 no longer use YAML::Node to hold metadata.
1604 =item prepare_metadata() [deprecated]
1608 [Deprecated] As of 0.36, authors should use C<get_metadata> instead. This
1609 method is preserved for backwards compatibility only.
1611 It takes three positional arguments: a hashref (to which metadata will be
1612 added), an optional arrayref (to which metadata keys will be added in order if
1613 the arrayref exists), and a hashref of arguments (as provided to get_metadata).
1614 The latter argument is new as of 0.36. Earlier versions are always fatal on
1617 Prior to version 0.36, this method took a YAML::Node as an argument to hold
1620 =item prereq_failures()
1624 Returns a data structure containing information about any failed
1625 prerequisites (of any of the types described above), or C<undef> if
1626 all prerequisites are met.
1628 The data structure returned is a hash reference. The top level keys
1629 are the type of prerequisite failed, one of "requires",
1630 "build_requires", "conflicts", or "recommends". The associated values
1631 are hash references whose keys are the names of required (or
1632 conflicting) modules. The associated values of those are hash
1633 references indicating some information about the failure. For example:
1638 message => 'Version 0.42 is installed, but we need version 0.59',
1646 message => 'Prerequisite Foo isn't installed',
1649 This hash has the same structure as the hash returned by the
1650 C<check_installed_status()> method, except that in the case of
1651 "conflicts" dependencies we change the "need" key to "conflicts" and
1652 construct a proper message.
1656 # Check a required dependency on Foo::Bar
1657 if ( $build->prereq_failures->{requires}{Foo::Bar} ) { ...
1659 # Check whether there were any failures
1660 if ( $build->prereq_failures ) { ...
1662 # Show messages for all failures
1663 my $failures = $build->prereq_failures;
1664 while (my ($type, $list) = each %$failures) {
1665 while (my ($name, $hash) = each %$list) {
1666 print "Failure for $name: $hash->{message}\n";
1674 Returns a reference to a hash describing all prerequisites. The keys of the
1675 hash will the various prerequisite types ('requires', 'build_requires',
1676 'configure_requires', 'recommends', or 'conflicts') and the values will
1677 references to hashes of module names and version numbers. Only prerequisites
1678 types that are defined will be included. The C<prereq_data> action is just a
1679 thin wrapper around the C<prereq_data()> method and dumps the hash as a string
1680 that can be loaded using C<eval()>.
1682 =item prereq_report()
1686 Returns a human-readable (table-form) string showing all
1687 prerequisites, the versions required, and the versions actually
1688 installed. This can be useful for reviewing the configuration of your
1689 system prior to a build, or when compiling data to send for a bug
1690 report. The C<prereq_report> action is just a thin wrapper around the
1691 C<prereq_report()> method.
1693 =item prompt($message, $default)
1697 Asks the user a question and returns their response as a string. The
1698 first argument specifies the message to display to the user (for
1699 example, C<"Where do you keep your money?">). The second argument,
1700 which is optional, specifies a default answer (for example,
1701 C<"wallet">). The user will be asked the question once.
1703 If C<prompt()> detects that it is not running interactively and there
1704 is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable
1705 is set to true, the $default will be used without prompting.
1707 To prevent automated processes from blocking, the user must either set
1708 PERL_MM_USE_DEFAULT or attach something to STDIN (this can be a
1709 pipe/file containing a scripted set of answers or /dev/null.)
1711 If no $default is provided an empty string will be used instead. In
1712 non-interactive mode, the absence of $default is an error (though
1713 explicitly passing C<undef()> as the default is valid as of 0.27.)
1715 This method may be called as a class or object method.
1721 Returns a hash reference indicating the C<recommends> prerequisites
1722 that were passed to the C<new()> method.
1728 Returns a hash reference indicating the C<requires> prerequisites that
1729 were passed to the C<new()> method.
1731 =item rscan_dir($dir, $pattern)
1735 Uses C<File::Find> to traverse the directory C<$dir>, returning a
1736 reference to an array of entries matching C<$pattern>. C<$pattern>
1737 may either be a regular expression (using C<qr//> or just a plain
1738 string), or a reference to a subroutine that will return true for
1739 wanted entries. If C<$pattern> is not given, all entries will be
1744 # All the *.pm files in lib/
1745 $m->rscan_dir('lib', qr/\.pm$/)
1747 # All the files in blib/ that aren't *.html files
1748 $m->rscan_dir('blib', sub {-f $_ and not /\.html$/});
1750 # All the files in t/
1753 =item runtime_params()
1755 =item runtime_params($key)
1759 The C<runtime_params()> method stores the values passed on the command line
1760 for valid properties (that is, any command line options for which
1761 C<valid_property()> returns a true value). The value on the command line may
1762 override the default value for a property, as well as any value specified in a
1763 call to C<new()>. This allows you to programmatically tell if C<perl Build.PL>
1764 or any execution of C<./Build> had command line options specified that
1765 override valid properties.
1767 The C<runtime_params()> method is essentially a glorified read-only hash. With
1768 no arguments, C<runtime_params()> returns the entire hash of properties
1769 specified on the command line. With one argument, C<runtime_params($key)>
1770 returns the value associated with the given key.
1772 The lifetime of the C<runtime_params> data is for "a build" - that is, the
1773 C<runtime_params> hash is created when C<perl Build.PL> is run (or when the
1774 C<new()> method is called, if the Module::Build Perl API is being used instead
1775 of called from a shell), and lasts until C<perl Build.PL> is run again or the
1776 C<clean> action is run.
1778 =item script_files()
1782 Returns a hash reference whose keys are the perl script files to be
1783 installed, if any. This corresponds to the C<script_files> parameter to the
1784 C<new()> method. With an optional argument, this parameter may be set
1787 For backward compatibility, the C<scripts()> method does exactly the
1788 same thing as C<script_files()>. C<scripts()> is deprecated, but it
1789 will stay around for several versions to give people time to
1792 =item up_to_date($source_file, $derived_file)
1794 =item up_to_date(\@source_files, \@derived_files)
1798 This method can be used to compare a set of source files to a set of
1799 derived files. If any of the source files are newer than any of the
1800 derived files, it returns false. Additionally, if any of the derived
1801 files do not exist, it returns false. Otherwise it returns true.
1803 The arguments may be either a scalar or an array reference of file
1806 =item y_n($message, $default)
1810 Asks the user a yes/no question using C<prompt()> and returns true or
1811 false accordingly. The user will be asked the question repeatedly
1812 until they give an answer that looks like "yes" or "no".
1814 The first argument specifies the message to display to the user (for
1815 example, C<"Shall I invest your money for you?">), and the second
1816 argument specifies the default answer (for example, C<"y">).
1818 Note that the default is specified as a string like C<"y"> or C<"n">,
1819 and the return value is a Perl boolean value like 1 or 0. I thought
1820 about this for a while and this seemed like the most useful way to do
1823 This method may be called as a class or object method.
1828 =head2 Autogenerated Accessors
1830 In addition to the aforementioned methods, there are also some get/set
1831 accessor methods for the following properties:
1837 =item allow_mb_mismatch()
1839 =item auto_configure_requires()
1853 =item build_elements()
1855 =item build_requires()
1857 =item build_script()
1861 =item bundle_inc_preload()
1867 =item configure_requires()
1873 =item create_license()
1875 =item create_makefile_pl()
1877 =item create_packlist()
1879 =item create_readme()
1891 =item include_dirs()
1893 =item install_base()
1901 =item magic_number()
1915 =item needs_compiler()
1929 =item prereq_action_types()
1931 =item program_name()
1937 =item recurse_into()
1939 =item recursive_test_files()
1947 =item tap_harness_args()
1949 =item test_file_exts()
1953 =item use_tap_harness()
1962 =head1 MODULE METADATA
1964 If you would like to add other useful metadata, C<Module::Build>
1965 supports this with the C<meta_add> and C<meta_merge> arguments to
1966 L</new()>. The authoritative list of supported metadata can be found at
1967 L<http://module-build.sourceforge.net/META-spec-current.html>, but for
1968 convenience - here are a few of the more useful ones:
1974 For describing the distribution using keyword (or "tags") in order to
1975 make CPAN.org indexing and search more efficient and useful.
1977 See L<http://module-build.sourceforge.net/META-spec-current.html#keywords>.
1981 A list of additional resources available for users of the
1982 distribution. This can include links to a homepage on the web, a
1983 bug tracker, the repository location, a even subscription page for the
1984 distribution mailing list.
1986 See L<http://module-build.sourceforge.net/META-spec-current.html#resources>.
1993 Ken Williams <kwilliams@cpan.org>
1998 Copyright (c) 2001-2006 Ken Williams. All rights reserved.
2000 This library is free software; you can redistribute it and/or
2001 modify it under the same terms as Perl itself.
2006 perl(1), L<Module::Build>(3), L<Module::Build::Authoring>(3),
2007 L<Module::Build::Cookbook>(3), L<ExtUtils::MakeMaker>(3), L<YAML::Tiny>(3)
2009 F<META.yml> Specification:
2010 L<http://module-build.sourceforge.net/META-spec-current.html>