Alien-ROOT
view release on metacpan or search on metacpan
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
=head1 NAME
Module::Build::API - API Reference for Module Authors
=for :stopwords apache bsd distdir distsign gpl installdirs lgpl mit mozilla packlists
=head1 DESCRIPTION
I list here some of the most important methods in C<Module::Build>.
Normally you won't need to deal with these methods unless you want to
subclass C<Module::Build>. But since one of the reasons I created
this module in the first place was so that subclassing is possible
(and easy), I will certainly write more docs as the interface
stabilizes.
=head2 CONSTRUCTORS
=over 4
=item current()
[version 0.20]
This method returns a reasonable facsimile of the currently-executing
C<Module::Build> object representing the current build. You can use
this object to query its L</notes()> method, inquire about installed
modules, and so on. This is a great way to share information between
different parts of your build process. For instance, you can ask
the user a question during C<perl Build.PL>, then use their answer
during a regression test:
# In Build.PL:
my $color = $build->prompt("What is your favorite color?");
$build->notes(color => $color);
# In t/colortest.t:
use Module::Build;
my $build = Module::Build->current;
my $color = $build->notes('color');
...
The way the C<current()> method is currently implemented, there may be
slight differences between the C<$build> object in Build.PL and the
one in C<t/colortest.t>. It is our goal to minimize these differences
in future releases of Module::Build, so please report any anomalies
you find.
One important caveat: in its current implementation, C<current()> will
B<NOT> work correctly if you have changed out of the directory that
C<Module::Build> was invoked from.
=item new()
[version 0.03]
Creates a new Module::Build object. Arguments to the new() method are
listed below. Most arguments are optional, but you must provide
either the L</module_name> argument, or L</dist_name> and one of
L</dist_version> or L</dist_version_from>. In other words, you must
provide enough information to determine both a distribution name and
version.
=over 4
=item add_to_cleanup
[version 0.19]
An array reference of files to be cleaned up when the C<clean> action
is performed. See also the L<add_to_cleanup()|/"add_to_cleanup(@files)">
method.
=item auto_configure_requires
[version 0.34]
This parameter determines whether Module::Build will add itself
automatically to configure_requires (and build_requires) if Module::Build
is not already there. The required version will be the last 'major' release,
as defined by the decimal version truncated to two decimal places (e.g. 0.34,
instead of 0.3402). The default value is true.
=item auto_features
[version 0.26]
This parameter supports the setting of features (see
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
specified. This is used when generating metadata for F<META.yml> and
PPD files. If this is not specified, then C<Module::Build> looks at
the module from which it gets the distribution's version. If it finds
a POD section marked "=head1 AUTHOR", then it uses the contents of
this section.
=item dist_name
[version 0.11]
Specifies the name for this distribution. Most authors won't need to
set this directly, they can use C<module_name> to set C<dist_name> to
a reasonable default. However, some agglomerative distributions like
C<libwww-perl> or C<bioperl> have names that don't correspond directly
to a module name, so C<dist_name> can be set independently.
=item dist_suffix
[version 0.37]
Specifies an optional suffix to include after the version number
in the distribution directory (and tarball) name. The only suffix
currently recognized by PAUSE is 'TRIAL', which indicates that the
distribution should not be indexed. For example:
Foo-Bar-1.23-TRIAL.tar.gz
This will automatically do the "right thing" depending on C<dist_version> and
C<release_status>. When C<dist_version> does not have an underscore and
C<release_status> is not 'stable', then C<dist_suffix> will default to 'TRIAL'.
Otherwise it will default to the empty string, disabling the suffix.
In general, authors should only set this if they B<must> override the default
behavior for some particular purpose.
=item dist_version
[version 0.11]
Specifies a version number for the distribution. See L</module_name>
or L</dist_version_from> for ways to have this set automatically from a
C<$VERSION> variable in a module. One way or another, a version
number needs to be set.
=item dist_version_from
[version 0.11]
Specifies a file to look for the distribution version in. Most
authors won't need to set this directly, they can use L</module_name>
to set it to a reasonable default.
The version is extracted from the specified file according to the same
rules as L<ExtUtils::MakeMaker> and C<CPAN.pm>. It involves finding
the first line that matches the regular expression
/([\$*])(([\w\:\']*)\bVERSION)\b.*\=/
eval()-ing that line, then checking the value of the C<$VERSION>
variable. Quite ugly, really, but all the modules on CPAN depend on
this process, so there's no real opportunity to change to something
better.
If the target file of L</dist_version_from> contains more than one package
declaration, the version returned will be the one matching the configured
L</module_name>.
=item dynamic_config
[version 0.07]
A boolean flag indicating whether the F<Build.PL> file must be
executed, or whether this module can be built, tested and installed
solely from consulting its metadata file. The main reason to set this
to a true value is that your module performs some dynamic
configuration as part of its build/install process. If the flag is
omitted, the F<META.yml> spec says that installation tools should
treat it as 1 (true), because this is a safer way to behave.
Currently C<Module::Build> doesn't actually do anything with this flag
- it's up to higher-level tools like C<CPAN.pm> to do something useful
with it. It can potentially bring lots of security, packaging, and
convenience improvements.
=item extra_compiler_flags
=item extra_linker_flags
[version 0.19]
These parameters can contain array references (or strings, in which
case they will be split into arrays) to pass through to the compiler
and linker phases when compiling/linking C code. For example, to tell
the compiler that your code is C++, you might do:
my $build = Module::Build->new
(
module_name => 'Foo::Bar',
extra_compiler_flags => ['-x', 'c++'],
);
To link your XS code against glib you might write something like:
my $build = Module::Build->new
(
module_name => 'Foo::Bar',
dynamic_config => 1,
extra_compiler_flags => scalar `glib-config --cflags`,
extra_linker_flags => scalar `glib-config --libs`,
);
=item get_options
[version 0.26]
You can pass arbitrary command line options to F<Build.PL> or
F<Build>, and they will be stored in the Module::Build object and can
be accessed via the L</args()> method. However, sometimes you want
more flexibility out of your argument processing than this allows. In
such cases, use the C<get_options> parameter to pass in a hash
reference of argument specifications, and the list of arguments to
F<Build.PL> or F<Build> will be processed according to those
specifications before they're passed on to C<Module::Build>'s own
argument processing.
The supported option specification hash keys are:
=over 4
=item type
The type of option. The types are those supported by Getopt::Long; consult
its documentation for a complete list. Typical types are C<=s> for strings,
C<+> for additive options, and C<!> for negatable options. If the
type is not specified, it will be considered a boolean, i.e. no
argument is taken and a value of 1 will be assigned when the option is
encountered.
=item store
A reference to a scalar in which to store the value passed to the option.
If not specified, the value will be stored under the option name in the
hash returned by the C<args()> method.
=item default
A default value for the option. If no default value is specified and no option
is passed, then the option key will not exist in the hash returned by
C<args()>.
=back
You can combine references to your own variables or subroutines with
unreferenced specifications, for which the result will also be stored in the
hash returned by C<args()>. For example:
my $loud = 0;
my $build = Module::Build->new
(
module_name => 'Foo::Bar',
get_options => {
Loud => { store => \$loud },
Dbd => { type => '=s' },
Quantity => { type => '+' },
}
);
print STDERR "HEY, ARE YOU LISTENING??\n" if $loud;
print "We'll use the ", $build->args('Dbd'), " DBI driver\n";
print "Are you sure you want that many?\n"
if $build->args('Quantity') > 2;
The arguments for such a specification can be called like so:
perl Build.PL --Loud --Dbd=DBD::pg --Quantity --Quantity --Quantity
B<WARNING:> Any option specifications that conflict with Module::Build's own
options (defined by its properties) will throw an exception. Use capitalized
option names to avoid unintended conflicts with future Module::Build options.
Consult the Getopt::Long documentation for details on its usage.
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
Also see the C<create_license> parameter.
=item meta_add
[version 0.28]
A hash of key/value pairs that should be added to the F<META.yml> file
during the C<distmeta> action. Any existing entries with the same
names will be overridden.
See the L</"MODULE METADATA"> section for details.
=item meta_merge
[version 0.28]
A hash of key/value pairs that should be merged into the F<META.yml>
file during the C<distmeta> action. Any existing entries with the
same names will be overridden.
The only difference between C<meta_add> and C<meta_merge> is their
behavior on hash-valued and array-valued entries: C<meta_add> will
completely blow away the existing hash or array value, but
C<meta_merge> will merge the supplied data into the existing hash or
array value.
See the L</"MODULE METADATA"> section for details.
=item module_name
[version 0.03]
The C<module_name> is a shortcut for setting default values of
C<dist_name> and C<dist_version_from>, reflecting the fact that the
majority of CPAN distributions are centered around one "main" module.
For instance, if you set C<module_name> to C<Foo::Bar>, then
C<dist_name> will default to C<Foo-Bar> and C<dist_version_from> will
default to C<lib/Foo/Bar.pm>. C<dist_version_from> will in turn be
used to set C<dist_version>.
Setting C<module_name> won't override a C<dist_*> parameter you
specify explicitly.
=item needs_compiler
[version 0.36]
The C<needs_compiler> parameter indicates whether a compiler is required to
build the distribution. The default is false, unless XS files are found or
the C<c_source> parameter is set, in which case it is true. If true,
L<ExtUtils::CBuilder> is automatically added to C<build_requires> if needed.
For a distribution where a compiler is I<optional>, e.g. a dual XS/pure-Perl
distribution, C<needs_compiler> should explicitly be set to a false value.
=item PL_files
[version 0.06]
An optional parameter specifying a set of C<.PL> files in your
distribution. These will be run as Perl scripts prior to processing
the rest of the files in your distribution with the name of the file
they're generating as an argument. They are usually used as templates
for creating other files dynamically, so that a file like
C<lib/Foo/Bar.pm.PL> might create the file C<lib/Foo/Bar.pm>.
The files are specified with the C<.PL> files as hash keys, and the
file(s) they generate as hash values, like so:
my $build = Module::Build->new
(
module_name => 'Foo::Bar',
...
PL_files => { 'lib/Foo/Bar.pm.PL' => 'lib/Foo/Bar.pm' },
);
Note that the path specifications are I<always> given in Unix-like
format, not in the style of the local system.
If your C<.PL> scripts don't create any files, or if they create files
with unexpected names, or even if they create multiple files, you can
indicate that so that Module::Build can properly handle these created
files:
PL_files => {
'lib/Foo/Bar.pm.PL' => 'lib/Foo/Bar.pm',
'lib/something.PL' => ['/lib/something', '/lib/else'],
'lib/funny.PL' => [],
}
Here's an example of a simple PL file.
my $output_file = shift;
open my $fh, ">", $output_file or die "Can't open $output_file: $!";
print $fh <<'END';
#!/usr/bin/perl
print "Hello, world!\n";
END
PL files are not installed by default, so its safe to put them in
F<lib/> and F<bin/>.
=item pm_files
[version 0.19]
An optional parameter specifying the set of C<.pm> files in this
distribution, specified as a hash reference whose keys are the files'
locations in the distributions, and whose values are their logical
locations based on their package name, i.e. where they would be found
in a "normal" Module::Build-style distribution. This parameter is
mainly intended to support alternative layouts of files.
For instance, if you have an old-style C<MakeMaker> distribution for a
module called C<Foo::Bar> and a F<Bar.pm> file at the top level of the
distribution, you could specify your layout in your C<Build.PL> like
this:
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
The default value. May optionally be specified as a code reference, in which
case the return value from the execution of the code reference will be used.
If you need the default to be a code reference, just use a code reference to
return it, e.g.:
default => sub { sub { ... } },
=item C<check>
A code reference that checks that a value specified for the property is valid.
During the execution of the code reference, the new value will be included in
the C<$_> variable. If the value is correct, the C<check> code reference
should return true. If the value is not correct, it sends an error message to
C<property_error()> and returns false.
=back
When this method is called, a new property will be installed in the
Module::Build class, and an accessor will be built to allow the property to be
get or set on the build object.
print $build->pedantic, $/;
$build->pedantic(0);
If the default value is a hash reference, this generates a special-case
accessor method, wherein individual key/value pairs may be set or fetched:
print "stuff{foo} is: ", $build->stuff( 'foo' ), $/;
$build->stuff( foo => 'bar' );
print $build->stuff( 'foo' ), $/; # Outputs "bar"
Of course, you can still set the entire hash reference at once, as well:
$build->stuff( { foo => 'bar', baz => 'yo' } );
In either case, if a C<check> has been specified for the property, it will be
applied to the entire hash. So the check code reference should look something
like:
check => sub {
return 1 if defined $_ && exists $_->{foo};
shift->property_error(qq{Property "stuff" needs "foo"});
return 0;
},
=item property_error
[version 0.31]
=back
=head2 METHODS
=over 4
=item add_build_element($type)
[version 0.26]
Adds a new type of entry to the build process. Accepts a single
string specifying its type-name. There must also be a method defined
to process things of that type, e.g. if you add a build element called
C<'foo'>, then you must also define a method called
C<process_foo_files()>.
See also
L<Module::Build::Cookbook/"Adding new file types to the build process">.
=item add_to_cleanup(@files)
[version 0.03]
You may call C<< $self->add_to_cleanup(@patterns) >> to tell
C<Module::Build> that certain files should be removed when the user
performs the C<Build clean> action. The arguments to the method are
patterns suitable for passing to Perl's C<glob()> function, specified
in either Unix format or the current machine's native format. It's
usually convenient to use Unix format when you hard-code the filenames
(e.g. in F<Build.PL>) and the native format when the names are
programmatically generated (e.g. in a testing script).
I decided to provide a dynamic method of the C<$build> object, rather
than just use a static list of files named in the F<Build.PL>, because
these static lists can get difficult to manage. I usually prefer to
keep the responsibility for registering temporary files close to the
code that creates them.
=item args()
[version 0.26]
my $args_href = $build->args;
my %args = $build->args;
my $arg_value = $build->args($key);
$build->args($key, $value);
This method is the preferred interface for retrieving the arguments passed via
command line options to F<Build.PL> or F<Build>, minus the Module-Build
specific options.
When called in in a scalar context with no arguments, this method returns a
reference to the hash storing all of the arguments; in an array context, it
returns the hash itself. When passed a single argument, it returns the value
stored in the args hash for that option key. When called with two arguments,
the second argument is assigned to the args hash under the key passed as the
first argument.
=item autosplit_file($from, $to)
[version 0.28]
Invokes the L<AutoSplit> module on the C<$from> file, sending the
output to the C<lib/auto> directory inside C<$to>. C<$to> is
typically the C<blib/> directory.
=item base_dir()
[version 0.14]
Returns a string containing the root-level directory of this build,
i.e. where the C<Build.PL> script and the C<lib> directory can be
found. This is usually the same as the current working directory,
because the C<Build> script will C<chdir()> into this directory as
soon as it begins execution.
=item build_requires()
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
error message.
If C<$version> is any non-true value (notably zero) and any version of
C<$module> is installed, we return true. In this case, if C<$module>
doesn't define a version, or if its version is zero, we return the
special value "0 but true", which is numerically zero, but logically
true.
In general you might prefer to use C<check_installed_status> if you
need detailed information, or this method if you just need a yes/no
answer.
=item compare_versions($v1, $op, $v2)
[version 0.28]
Compares two module versions C<$v1> and C<$v2> using the operator
C<$op>, which should be one of Perl's numeric operators like C<!=> or
C<< >= >> or the like. We do at least a halfway-decent job of
handling versions that aren't strictly numeric, like C<0.27_02>, but
exotic stuff will likely cause problems.
In the future, the guts of this method might be replaced with a call
out to C<version.pm>.
=item config($key)
=item config($key, $value)
=item config() [deprecated]
[version 0.22]
With a single argument C<$key>, returns the value associated with that
key in the C<Config.pm> hash, including any changes the author or user
has specified.
With C<$key> and C<$value> arguments, sets the value for future
callers of C<config($key)>.
With no arguments, returns a hash reference containing all such
key-value pairs. This usage is deprecated, though, because it's a
resource hog and violates encapsulation.
=item config_data($name)
=item config_data($name => $value)
[version 0.26]
With a single argument, returns the value of the configuration
variable C<$name>. With two arguments, sets the given configuration
variable to the given value. The value may be any Perl scalar that's
serializable with C<Data::Dumper>. For instance, if you write a
module that can use a MySQL or PostgreSQL back-end, you might create
configuration variables called C<mysql_connect> and
C<postgres_connect>, and set each to an array of connection parameters
for C<< DBI->connect() >>.
Configuration values set in this way using the Module::Build object
will be available for querying during the build/test process and after
installation via the generated C<...::ConfigData> module, as
C<< ...::ConfigData->config($name) >>.
The L<feature()|/"feature($name)"> and C<config_data()> methods represent
Module::Build's main support for configuration of installed modules.
See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">.
=item conflicts()
[version 0.21]
Returns a hash reference indicating the C<conflicts> prerequisites
that were passed to the C<new()> method.
=item contains_pod($file) [deprecated]
[version 0.20]
[Deprecated] Please see L<Module::Build::ModuleInfo> instead.
Returns true if the given file appears to contain POD documentation.
Currently this checks whether the file has a line beginning with
'=pod', '=head', or '=item', but the exact semantics may change in the
future.
=item copy_if_modified(%parameters)
[version 0.19]
Takes the file in the C<from> parameter and copies it to the file in
the C<to> parameter, or the directory in the C<to_dir> parameter, if
the file has changed since it was last copied (or if it doesn't exist
in the new location). By default the entire directory structure of
C<from> will be copied into C<to_dir>; an optional C<flatten>
parameter will copy into C<to_dir> without doing so.
Returns the path to the destination file, or C<undef> if nothing
needed to be copied.
Any directories that need to be created in order to perform the
copying will be automatically created.
The destination file is set to read-only. If the source file has the
executable bit set, then the destination file will be made executable.
=item create_build_script()
[version 0.05]
Creates an executable script called C<Build> in the current directory
that will be used to execute further user actions. This script is
roughly analogous (in function, not in form) to the Makefile created
by C<ExtUtils::MakeMaker>. This method also creates some temporary
data in a directory called C<_build/>. Both of these will be removed
when the C<realclean> action is performed.
Among the files created in C<_build/> is a F<_build/prereqs> file
containing the set of prerequisites for this distribution, as a hash
of hashes. This file may be C<eval()>-ed to obtain the authoritative
set of prerequisites, which might be different from the contents of
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
doesn't really provide an easy way to figure this out (but
C<Path::Class> does...).
=item dispatch($action, %args)
[version 0.03]
Invokes the build action C<$action>. Optionally, a list of options
and their values can be passed in. This is equivalent to invoking an
action at the command line, passing in a list of options.
Custom options that have not been registered must be passed in as a
hash reference in a key named "args":
$build->dispatch('foo', verbose => 1, args => { my_option => 'value' });
This method is intended to be used to programmatically invoke build
actions, e.g. by applications controlling Module::Build-based builds
rather than by subclasses.
See also L<depends_on()|/"depends_on(@actions)">. The main
distinction between the two is that C<depends_on()> is meant to call
an action from inside another action, whereas C<dispatch()> is meant
to set the very top action in motion.
=item dist_dir()
[version 0.28]
Returns the name of the directory that will be created during the
C<dist> action. The name is derived from the C<dist_name> and
C<dist_version> properties.
=item dist_name()
[version 0.21]
Returns the name of the current distribution, as passed to the
C<new()> method in a C<dist_name> or modified C<module_name>
parameter.
=item dist_version()
[version 0.21]
Returns the version of the current distribution, as determined by the
C<new()> method from a C<dist_version>, C<dist_version_from>, or
C<module_name> parameter.
=item do_system($cmd, @args)
[version 0.21]
This is a fairly simple wrapper around Perl's C<system()> built-in
command. Given a command and an array of optional arguments, this
method will print the command to C<STDOUT>, and then execute it using
Perl's C<system()>. It returns true or false to indicate success or
failure (the opposite of how C<system()> works, but more intuitive).
Note that if you supply a single argument to C<do_system()>, it
will/may be processed by the system's shell, and any special
characters will do their special things. If you supply multiple
arguments, no shell will get involved and the command will be executed
directly.
=item extra_compiler_flags()
=item extra_compiler_flags(@flags)
[version 0.25]
Set or retrieve the extra compiler flags. Returns an arrayref of flags.
=item extra_linker_flags()
=item extra_linker_flags(@flags)
[version 0.25]
Set or retrieve the extra linker flags. Returns an arrayref of flags.
=item feature($name)
=item feature($name => $value)
[version 0.26]
With a single argument, returns true if the given feature is set.
With two arguments, sets the given feature to the given boolean value.
In this context, a "feature" is any optional functionality of an
installed module. For instance, if you write a module that could
optionally support a MySQL or PostgreSQL backend, you might create
features called C<mysql_support> and C<postgres_support>, and set them
to true/false depending on whether the user has the proper databases
installed and configured.
Features set in this way using the Module::Build object will be
available for querying during the build/test process and after
installation via the generated C<...::ConfigData> module, as
C<< ...::ConfigData->feature($name) >>.
The C<feature()> and C<config_data()> methods represent
Module::Build's main support for configuration of installed modules.
See also L<Module::Build::Authoring/"SAVING CONFIGURATION INFORMATION">.
=item fix_shebang_line(@files)
[version 0.??]
Modify any "shebang" line in the specified files to use the path to the
perl executable being used for the current build. Files are modified
in-place. The existing shebang line must have a command that contains
"C<perl>"; arguments to the command do not count. In particular, this
means that the use of C<#!/usr/bin/env perl> will not be changed.
For an explanation of shebang lines, see
L<http://en.wikipedia.org/wiki/Shebang_%28Unix%29>.
=item have_c_compiler()
[version 0.21]
Returns true if the current system seems to have a working C compiler.
We currently determine this by attempting to compile a simple C source
file and reporting whether the attempt was successful.
=item install_base_relpaths()
=item install_base_relpaths($type)
=item install_base_relpaths($type => $path)
[version 0.28]
Set or retrieve the relative paths that are appended to
C<install_base> for any installable element. This is useful if you
want to set the relative install path for custom build elements.
With no argument, it returns a reference to a hash containing all
elements and their respective values. This hash should not be modified
directly; use the multiple argument below form to change values.
The single argument form returns the value associated with the
element C<$type>.
The multiple argument form allows you to set the paths for element types.
C<$value> must be a relative path using Unix-like paths. (A series of
directories separated by slashes, e.g. C<foo/bar>.) The return value is a
localized path based on C<$value>.
Assigning the value C<undef> to an element causes it to be removed.
=item install_destination($type)
[version 0.28]
Returns the directory in which items of type C<$type> (e.g. C<lib>,
C<arch>, C<bin>, or anything else returned by the L</install_types()>
inc/inc_Module-Build/Module/Build/API.pod view on Meta::CPAN
}
This hash has the same structure as the hash returned by the
C<check_installed_status()> method, except that in the case of
"conflicts" dependencies we change the "need" key to "conflicts" and
construct a proper message.
Examples:
# Check a required dependency on Foo::Bar
if ( $build->prereq_failures->{requires}{Foo::Bar} ) { ...
# Check whether there were any failures
if ( $build->prereq_failures ) { ...
# Show messages for all failures
my $failures = $build->prereq_failures;
while (my ($type, $list) = each %$failures) {
while (my ($name, $hash) = each %$list) {
print "Failure for $name: $hash->{message}\n";
}
}
=item prereq_data()
[version 0.32]
Returns a reference to a hash describing all prerequisites. The keys of the
hash will be the various prerequisite types ('requires', 'build_requires',
'configure_requires', 'recommends', or 'conflicts') and the values will be
references to hashes of module names and version numbers. Only prerequisites
types that are defined will be included. The C<prereq_data> action is just a
thin wrapper around the C<prereq_data()> method and dumps the hash as a string
that can be loaded using C<eval()>.
=item prereq_report()
[version 0.28]
Returns a human-readable (table-form) string showing all
prerequisites, the versions required, and the versions actually
installed. This can be useful for reviewing the configuration of your
system prior to a build, or when compiling data to send for a bug
report. The C<prereq_report> action is just a thin wrapper around the
C<prereq_report()> method.
=item prompt($message, $default)
[version 0.12]
Asks the user a question and returns their response as a string. The
first argument specifies the message to display to the user (for
example, C<"Where do you keep your money?">). The second argument,
which is optional, specifies a default answer (for example,
C<"wallet">). The user will be asked the question once.
If C<prompt()> detects that it is not running interactively and there
is nothing on STDIN or if the PERL_MM_USE_DEFAULT environment variable
is set to true, the $default will be used without prompting.
To prevent automated processes from blocking, the user must either set
PERL_MM_USE_DEFAULT or attach something to STDIN (this can be a
pipe/file containing a scripted set of answers or /dev/null.)
If no $default is provided an empty string will be used instead. In
non-interactive mode, the absence of $default is an error (though
explicitly passing C<undef()> as the default is valid as of 0.27.)
This method may be called as a class or object method.
=item recommends()
[version 0.21]
Returns a hash reference indicating the C<recommends> prerequisites
that were passed to the C<new()> method.
=item requires()
[version 0.21]
Returns a hash reference indicating the C<requires> prerequisites that
were passed to the C<new()> method.
=item rscan_dir($dir, $pattern)
[version 0.28]
Uses C<File::Find> to traverse the directory C<$dir>, returning a
reference to an array of entries matching C<$pattern>. C<$pattern>
may either be a regular expression (using C<qr//> or just a plain
string), or a reference to a subroutine that will return true for
wanted entries. If C<$pattern> is not given, all entries will be
returned.
Examples:
# All the *.pm files in lib/
$m->rscan_dir('lib', qr/\.pm$/)
# All the files in blib/ that aren't *.html files
$m->rscan_dir('blib', sub {-f $_ and not /\.html$/});
# All the files in t/
$m->rscan_dir('t');
=item runtime_params()
=item runtime_params($key)
[version 0.28]
The C<runtime_params()> method stores the values passed on the command line
for valid properties (that is, any command line options for which
C<valid_property()> returns a true value). The value on the command line may
override the default value for a property, as well as any value specified in a
call to C<new()>. This allows you to programmatically tell if C<perl Build.PL>
or any execution of C<./Build> had command line options specified that
override valid properties.
The C<runtime_params()> method is essentially a glorified read-only hash. With
( run in 0.893 second using v1.01-cache-2.11-cpan-8f98c5d2c55 )