package Module::Build; # This module doesn't do much of anything itself, it inherits from the # modules that do the real work. The only real thing it has to do is # figure out which OS-specific module to pull in. Many of the # OS-specific modules don't do anything either - most of the work is # done in Module::Build::Base. use strict; use File::Spec (); use File::Path (); use File::Basename (); use vars qw($VERSION @ISA); $VERSION = '0.20'; # Okay, this is the brute-force method of finding out what kind of # platform we're on. I don't know of a systematic way. These values # came from the latest (bleadperl) perlport.pod. my %OSTYPES = qw( aix Unix bsdos Unix dgux Unix dynixptx Unix freebsd Unix linux Unix hpux Unix irix Unix darwin Unix machten Unix next Unix openbsd Unix dec_osf Unix svr4 Unix sco_sv Unix svr4 Unix unicos Unix unicosmk Unix solaris Unix sunos Unix cygwin Unix dos Windows MSWin32 Windows os390 EBCDIC os400 EBCDIC posix-bc EBCDIC vmesa EBCDIC MacOS MacOS VMS VMS VOS VOS riscos RiscOS amigaos Amiga mpeix MPEiX ); # We only use this once - don't waste a symbol table entry on it. # More importantly, don't make it an inheritable method. my $load = sub { my $mod = shift; #warn "Using $mod"; eval "use $mod"; die $@ if $@; @ISA = ($mod); }; if (grep {-e File::Spec->catfile($_, qw(Module Build Platform), $^O) . '.pm'} @INC) { $load->("Module::Build::Platform::$^O"); } elsif (exists $OSTYPES{$^O}) { $load->("Module::Build::Platform::$OSTYPES{$^O}"); } else { warn "Unknown OS type '$^O' - using default settings\n"; $load->("Module::Build::Platform::Default"); } sub os_type { $OSTYPES{$^O} } 1; __END__ =head1 NAME Module::Build - Build and install Perl modules =head1 SYNOPSIS Standard process for building & installing modules: perl Build.PL ./Build ./Build test ./Build install Or, if you're on a platform (like DOS or Windows) that doesn't like the "./" notation, you can do this: perl Build.PL perl Build perl Build test perl Build install =head1 DESCRIPTION C is a system for building, testing, and installing Perl modules. It is meant to be a replacement for C. Developers may alter the behavior of the module through subclassing in a much more straightforward way than with C. It also does not require a C on your system - most of the C code is pure-perl and written in a very cross-platform way. In fact, you don't even need a shell, so even platforms like MacOS (traditional) can use it fairly easily. Its only prerequisites are modules that are included with perl 5.6.0, and it works fine on perl 5.005 if you can install a few additional modules. See L for more comparisons between C and C. To install C, and any other module that uses C for its installation process, do the following: perl Build.PL # 'Build.PL' script creates the 'Build' script ./Build # Need ./ to ensure we're using this "Build" script ./Build test # and not another one that happens to be in the PATH ./Build install This illustrates initial configuration and the running of three 'actions'. In this case the actions run are 'build' (the default action), 'test', and 'install'. Actions defined so far include: build docs clean fakeinstall code help diff install dist manifest distcheck ppd distclean realclean distdir skipcheck distmeta test distsign testdb disttest versioninstall You can run the 'help' action for a complete list of actions. When creating a C script for a module, something like the following code will typically be used: use Module::Build; my $build = Module::Build->new ( module_name => 'Foo::Bar', license => 'perl', requires => { 'perl' => '5.6.1', 'Some::Module' => '1.23', 'Other::Module' => '>= 1.2, != 1.5, < 2.0', }, ); $build->create_build_script; A simple module could get away with something as short as this for its C script: use Module::Build; Module::Build->new( module_name => 'Foo::Bar', license => 'perl', )->create_build_script; The model used by C is a lot like the C metaphor, with the following correspondences: In Module::Build In ExtUtils::MakeMaker --------------------------- ------------------------ Build.PL (initial script) Makefile.PL (initial script) Build (a short perl script) Makefile (a long Makefile) _build/ (saved state info) various config text in the Makefile Any customization can be done simply by subclassing C and adding a method called (for example) C, overriding the default 'test' action. You could also add a method called C, and then you could perform the action C. For information on providing backward compatibility with C, see L. =head1 METHODS I list here some of the most important methods in C. Normally you won't need to deal with these methods unless you want to subclass C. 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. =over 4 =item new() Creates a new Module::Build object. Arguments to the new() method are listed below. Most arguments are optional, but you must provide either the C argument, or C and one of C or C. In other words, you must provide enough information to determine both a distribution name and version. =over 4 =item module_name The C is a shortcut for setting default values of C and C, reflecting the fact that the majority of CPAN distributions are centered around one "main" module. For instance, if you set C to C, then C will default to C and C will default to C. C will in turn be used to set C. Setting C won't override a C parameter you specify explicitly. =item dist_name Specifies the name for this distribution. Most authors won't need to set this directly, they can use C to set C to a reasonable default. However, some agglomerative distributions like C or C have names that don't correspond directly to a module name, so C can be set independently. =item dist_version Specifies a version number for the distribution. See C or C 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 Specifies a file to look for the distribution version in. Most authors won't need to set this directly, they can use C to set it to a reasonable default. The version is extracted from the specified file according to the same rules as C and C. 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. =item license Specifies the licensing terms of your distribution. Valid options include: =over 4 =item perl The distribution may be copied and redistributed under the same terms as perl itself (this is by far the most common licensing option for modules on CPAN). This is a dual license, in which the user may choose between either the GPL or the Artistic license. =item gpl The distribution is distributed under the terms of the Gnu General Public License (http://www.opensource.org/licenses/gpl-license.php). =item lgpl The distribution is distributed under the terms of the Gnu Lesser General Public License (http://www.opensource.org/licenses/lgpl-license.php). =item artistic The distribution is licensed under the Artistic License, as specified by the F file in the standard perl distribution. =item bsd The distribution is licensed under the BSD License (http://www.opensource.org/licenses/bsd-license.php). =item open_source The distribution is licensed under some other Open Source Initiative-approved license listed at http://www.opensource.org/licenses/ . =item unrestricted The distribution is licensed under a license that is B approved by www.opensource.org but that allows distribution without restrictions. =item restrictive The distribution may not be redistributed without special permission from the author and/or copyright holder. =back Note that you must still include the terms of your license in your documentation - this field only lets automated tools figure out your licensing restrictions. Humans still need something to read. It is a fatal error to use a license other than the ones mentioned above. This is not because I wish to impose licensing terms on you - please let me know if you would like another license option to be added to the list. You may also use a license type of C if you don't wish to specify your terms (but this is usually not a good idea for you to do!). I just started out with a small set of licenses to keep things simple, figuring I'd let people with actual working knowledge in this area tell me what to do. So if that's you, drop me a line. =item requires An optional C argument specifies any module prerequisites that the current module depends on. The prerequisites are given in a hash reference, where the keys are the module names and the values are version specifiers: requires => {Foo::Module => '2.4', Bar::Module => 0, Ken::Module => '>= 1.2, != 1.5, < 2.0', perl => '5.6.0'}, These four version specifiers have different effects. The value C<'2.4'> means that B version 2.4 of C must be installed. The value C<0> means that B version of C is acceptable, even if C doesn't define a version. The more verbose value C<'E= 1.2, != 1.5, E 2.0'> means that C's version must be B 1.2, B 2.0, and B 1.5. The list of criteria is separated by commas, and all criteria must be satisfied. A special C entry lets you specify the versions of the Perl interpreter that are supported by your module. The same version dependency-checking semantics are available, except that we also understand perl's new double-dotted version numbers. One note: currently C doesn't actually I the user to have dependencies installed, it just strongly urges. In the future we may require it. There's now a C section for things that aren't absolutely required. Automated tools like CPAN.pm should refuse to install a module if one of its dependencies isn't satisfied, unless a "force" command is given by the user. If the tools are helpful, they should also offer to install the dependencies. A sysnonym for C is C, to help succour people transitioning from C. The C term is preferred, but the C term will remain valid in future distributions. =item recommends This is just like the C argument, except that modules listed in this section aren't essential, just a good idea. We'll just print a friendly warning if one of these modules aren't found, but we'll continue running. If a module is recommended but not required, all tests should still pass if the module isn't installed. This may mean that some tests will be skipped if recommended dependencies aren't present. Automated tools like CPAN.pm should inform the user when recommended modules aren't installed, and it should offer to install them if it wants to be helpful. =item build_requires Modules listed in this section are necessary to build and install the given module, but are not necessary for regular usage of it. This is actually an important distinction - it allows for tighter control over the body of installed modules, and facilitates correct dependency checking on binary/packaged distributions of the module. =item conflicts Modules listed in this section conflict in some serious way with the given module. C will refuse to install the given module if =item create_makefile_pl This parameter lets you use Module::Build::Compat during the C (or C) action to automatically create a Makefile.PL for compatibility with ExtUtils::MakeMaker. The parameter's value should be one of the styles named in the Module::Build::Compat documentation. =item c_source An optional C argument specifies a directory which contains C source files that the rest of the build may depend on. Any C<.c> files in the directory will be compiled to object files. The directory will be added to the search path during the compilation and linking phases of any C or XS files. =item pm_files 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 MakeMaker distribution for a module called C and a F file at the top level of the distribution, you could specify your layout in your C like this: my $build = Module::Build->new ( module_name => 'Foo::Bar', ... pm_files => { 'Bar.pm' => 'lib/Foo/Bar.pm' }, ); Note that the values should include C, because this is where they would be found in a "normal" Module::Build-style distribution. Note also that the path specifications are I given in Unix-like format, not in the style of the local system. =item pod_files Just like C, but used for specifying the set of C<.pod> files in your distribution. =item xs_files Just like C, but used for specifying the set of C<.xs> files in your distribution. =item PL_files 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. They are usually used as templates for creating other files dynamically, so that a file like C might create the file C. 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/Bar.pm.PL' => 'lib/Bar.pm', 'lib/Foo.PL' => [ 'lib/Foo1.pm', 'lib/Foo2.pm' ], }, ); Note that the path specifications are I given in Unix-like format, not in the style of the local system. =item script_files An optional parameter specifying a set of files that should be installed as executable perl scripts when the module is installed. May be given as an array reference of the files, or as a hash reference whose keys are the files (and whose values will currently be ignored). The default is to install no script files - in other words, there is no default location where Module::Build will look for script files to install. For backward compatibility, you may use the parameter C instead of C. Please consider this usage deprecated, though it will continue to exist for several version releases. =item autosplit An optional C argument specifies a file which should be run through the C function. In general I don't consider this a great idea, because it's not always clear that autosplitting achieves its intended performance benefits. It may even harm performance in environments like mod_perl, where as much as possible of a module's code should be loaded during startup. =item dynamic_config A boolean flag indicating whether the F file must be executed, or whether this module can be built, tested and installed solely from consulting its metadata file. The default value is 0, reflecting the fact that "most" of the modules on CPAN just need to be copied from one place to another. 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. Currently C doesn't actually do anything with this flag - it's probably going to be up to tools like C to do something useful with it. It can potentially bring lots of security, packaging, and convenience improvements. =item add_to_cleanup An array reference of files to be cleaned up when the C action is performed. See also the add_to_cleanup() method. =item sign If a true value is specified for this parameter, C will be used (via the 'distsign' action) to create a SIGNATURE file for your distribution during the 'distdir' action. The default is false. In the future, the default may change to true if you have C installed on your system. =item extra_compiler_flags =item extra_linker_flags 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 => 'Spangly', extra_compiler_flags => ['-x', 'c++'], ); To link your XS code against glib you might write something like: my build = Module::Build->new( module_name => 'Spangly', dynamic_config => 1, extra_compiler_flags => `glib-config --cflags`, extra_linker_flags => `glib-config --libs`, ); =item dist_author This should be something like "John Doe ". This is used when creating PPD files. If this is not specified, then C 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_abstract This should be a short description of the distribution. This is used when creating PPD files. If it is not given then C looks in the POD of the module from which it gets the distribution's version. It looks for the first line matching C<$package\s-\s(.+)>, and uses the captured text as the abstract. =item codebase This can be either a single scalar string, or an array reference of strings. It is required when creating PPD files. It should be a URL, or URLs, to be used as the value for the C<< >> tag in the generated PPD. =back =item create_build_script() Creates an executable script called C 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. This method also creates some temporary data in a directory called C<_build/>. Both of these will be removed when the C action is performed. =item add_to_cleanup(@files) You may call C<< $self->add_to_cleanup(@files) >> to tell C that certain files should be removed when the user performs the C action. I decided to provide a dynamic method, rather than just use a static list of files, 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 resume() You'll probably never call this method directly, it's only called from the auto-generated C script. The C method is only called once, when the user runs C. Thereafter, when the user runs C or another action, the C object is created using the C method to reinstantiate with the settings given earlier to C. =item current() This method returns a reasonable faxsimile of the currently-executing C object representing the current build. You can use this object to query its C method, inquire about installed modules, and so on. This is a great way to share information between different parts of your building process. For instance, you can ask the user a question during C, 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 method is currently implemented, there may be slight differences between the C<$build> object in Build.PL and the one in C. It is our goal to minimize these differences in future releases of Module::Build, so please report any anomalies you find. =item notes() =item notes($key) =item notes($key => $value) The C value allows you to store your own persistent information about the build, and to share that information among different entities involved in the build. See the example in the C method. The C method is essentally a glorified hash access. With no arguments, C returns a reference to the entire hash of notes. With one argument, C returns the value associated with the given key. With two arguments, C sets the value associated with the given key to C<$value>. =item dispatch($action, %args) This method is also called from the auto-generated C script. It parses the command-line arguments into an action and an argument list, then calls the appropriate routine to handle the action. Currently (though this may change), an action C will invoke the C method. All arguments (including everything mentioned in L below) are contained in the C<< $self->{args} >> hash reference. =item os_type() If you're subclassing Module::Build and some code needs to alter its behavior based on the current platform, you may only need to know whether you're running on Windows, Unix, MacOS, VMS, etc. and not the fine-grained value of Perl's C<$^O> variable. The C method will return a string like C, C, C, C, or whatever is appropriate. If you're running on an unknown platform, it will return C - there shouldn't be many unknown platforms though. =item prereq_failures() Returns a data structure containing information about any failed prerequisites (of any of the types described above), or C if all prerequisites are met. The data structure returned is a hash reference. The top level keys are the type of prerequisite failed, one of "requires", "build_requires", "conflicts", or "recommends". The associated values are hash references whose keys are the names of required (or conflicting) modules. The associated values of those are hash references indicating some information about the failure. For example: { have => '0.42', need => '0.59', message => 'Version 0.42 is installed, but we need version 0.59', } or { have => '', need => '0.59', message => 'Prerequisite Foo isn't installed', } This hash has the same structure as the hash returned by the C 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 ( $m->prereq_failures->{requires}{Foo::Bar} ) { ... # Check whether there were any failures if ( $m->prereq_failures ) { ... # Show messages for all failures my $failures = $m->prereq_failures; while (my ($type, $list) = each %$failures) { while (my ($name, $hash) = each %$list) { print "Failure for $name: $hash->{message}\n"; } } =item check_installed_status($module, $version) This method returns a hash reference indicating whether a version dependency on a certain module is satisfied. The C<$module> argument is given as a string like C<"Data::Dumper"> or C<"perl">, and the C<$version> argument can take any of the forms described in L above. This allows very fine-grained version checking. The returned hash reference has the following structure: { ok => $whether_the_dependency_is_satisfied, have => $version_already_installed, need => $version_requested, # Same as incoming $version argument message => $informative_error_message, } If no version of C<$module> is currently installed, the C value will be the string C<< "" >>. Otherwise the C value will simply be the version of the installed module. Note that this means that if C<$module> is installed but doesn't define a version number, the C value will be C - this is why we don't use C for the case when C<$module> isn't installed at all. This method may be called either as an object method (C<< $build->check_installed_status($module, $version) >>) or as a class method (C<< Module::Build->check_installed_status($module, $version) >>). =item check_installed_version($module, $version) Like C, but simply returns true or false depending on whether module C<$module> statisfies the dependency C<$version>. If the check succeeds, the return value is the actual version of C<$module> installed on the system. This allows you to do the following: my $installed = $m->check_installed_version('DBI', '1.15'); if ($installed) { print "Congratulations, version $installed of DBI is installed.\n"; } else { die "Sorry, you must install DBI.\n"; } If the check fails, we return false and set C<$@> to an informative error message. If C<$version> is any nontrue 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 if you need detailed information, or this method if you just need a yes/no answer. =item prompt($message, $default) 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 the current session doesn't seem to be interactive (i.e. if C and C look like they're attached to files or something, not terminals), we'll just use the default without letting the user provide an answer. This method may be called as a class or object method. =item y_n($message, $default) Asks the user a yes/no question using C and returns true or false accordingly. The user will be asked the question repeatedly until they give an answer that looks like "yes" or "no". The first argument specifies the message to display to the user (for example, C<"Shall I invest your money for you?">), and the second argument specifies the default answer (for example, C<"y">). Note that the default is specified as a string like C<"y"> or C<"n">, and the return value is a Perl boolean value like 1 or 0. I thought about this for a while and this seemed like the most useful way to do it. This method may be called as a class or object method. =item script_files() Returns an array reference specifying the perl script files to be installed. This corresponds to the C parameter to the C method. With an optional argument, this parameter may be set dynamically. For backward compatibility, the C method does exactly the same thing as C. C is deprecated, but it will stay around for several versions to give people time to transition. =item copy_if_modified(%parameters) Takes the file in the C parameter and copies it to the file in the C parameter, or the directory in the C 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 will be copied into C; an optional C parameter will copy into C without doing so. Returns the path to the destination file, or C if nothing needed to be copied. Any directories that need to be created in order to perform the copying will be automatically created. =item base_dir() Returns a string containing the root-level directory of this build, i.e. where the C script and the C directory can be found. This is usually the same as the current working directory, because the C script will C into this directory as soon as it begins execution. =item up_to_date($source_file, $derived_file) =item up_to_date(\@source_files, \@derived_files) This method can be used to compare a set of source files to a set of derived files. If any of the source files are newer than any of the derived files, it returns false. Additionally, if any of the derived files do not exist, it returns false. Otherwise it returns true. The arguments may be either a scalar or an array reference of file names. =item contains_pod($file) 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. =back =head1 ACTIONS There are some general principles at work here. First, each task when building a module is called an "action". These actions are listed above; they correspond to the building, testing, installing, packaging, etc. tasks. Second, arguments are processed in a very systematic way. Arguments are always key=value pairs. They may be specified at C time (i.e. C), in which case their values last for the lifetime of the C script. They may also be specified when executing a particular action (i.e. C), in which case their values last only for the lifetime of that command. Per-action command-line parameters take precedence over parameters specified at C time. The build process also relies heavily on the C module, and all the key=value pairs in C are available in C<< $self->{config} >>. If the user wishes to override any of the values in C, she may specify them like so: perl Build.PL config='cc=gcc ld=gcc' Not the greatest interface, I'm looking for alternatives. Speak now! Maybe: perl Build.PL config=cc:gcc config=ld:gcc or something. The following build actions are provided by default. =over 4 =item help This action will simply print out a message that is meant to help you use the build process. It will show you a list of available build actions too. With an optional argument specifying an action name (e.g. C), the 'help' action will show you any POD documentation it can find for that action. =item build If you run the C script without any arguments, it runs the C action. This is analogous to the MakeMaker 'make all' target. By default it just creates a C directory and copies any C<.pm> and C<.pod> files from your C directory into the C directory. It also compiles any C<.xs> files from C and places them in C. Of course, you need a working C compiler (probably the same one that built perl itself) for this to work properly. The C action also runs any C<.PL> files in your F directory. Typically these create other files, named the same but without the C<.PL> ending. For example, a file F could create the file F. The C<.PL> files are processed first, so any C<.pm> files (or other kinds that we deal with) will get copied correctly. 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 should tell us that so that we can clean up properly after these created files. Use the C parameter to C: PL_files => { 'lib/Foo/Bar_pm.PL' => 'lib/Foo/Bar.pm', 'lib/something.PL' => ['/lib/something', '/lib/else'], 'lib/funny.PL' => [] } Note that in contrast to MakeMaker, the C action only (currently) handles C<.pm>, C<.pod>, C<.PL>, and C<.xs> files. They must all be in the C directory, in the directory structure that they should have when installed. We also handle C<.c> files that can be in the place of your choosing - see the C argument to C. The C<.xs> support is currently in alpha. Please let me know whether it works for you. =item test This will use C to run any regression tests and report their results. Tests can be defined in the standard places: a file called C in the top-level directory, or several files ending with C<.t> in a C directory. If you want tests to be 'verbose', i.e. show details of test execution rather than just summary information, pass the argument C. If you want to run tests under the perl debugger, pass the argument C. In addition, if a file called C exists in the top-level directory, this file will be executed as a Perl script and its output will be shown to the user. This is a good place to put speed tests or other tests that don't use the C format for output. To override the choice of tests to run, you may pass a C argument whose value is a whitespace-separated list of test scripts to run. This is especially useful in development, when you only want to run a single test to see whether you've squashed a certain bug yet: ./Build test --test_files t/something_failing.t You may also pass several C arguments separately: ./Build test --test_files t/one.t --test_files t/two.t or use a C-style pattern: ./Build test --test_files 't/01-*.t' =item testdb This is a synonym for the 'test' action with the C argument. =item clean This action will clean up any files that the build process may have created, including the C directory (but not including the C<_build/> directory and the C script itself). =item realclean This action is just like the C action, but also removes the C<_build> directory and the C script. If you run the C action, you are essentially starting over, so you will have to re-create the C script again. =item diff This action will compare the files about to be installed with their installed counterparts. For .pm and .pod files, a diff will be shown (this currently requires a 'diff' program to be in your PATH). For other files like compiled binary files, we simply report whether they differ. A C parameter may be passed to the action, which will be passed to the 'diff' program. Consult your 'diff' documentation for the parameters it will accept - a good one is C<-u>: ./Build diff flags=-u =item install This action will use C to install the files from C into the system. See L for details about how Module::Build determines where to install things, and how to influence this process. If you want the installation process to look around in C<@INC> for other versions of the stuff you're installing and try to delete it, you can use the C parameter, which tells C to do so: Build install uninst=1 This can be a good idea, as it helps prevent multiple versions of a module from being present on your system, which can be a confusing situation indeed. =item fakeinstall This is just like the C action, but it won't actually do anything, it will just report what it I have done if you had actually run the C action. =item versioninstall ** Note: since C is so new, and since we just recently added support for it here too, this feature is to be considered experimental. ** If you have the C module installed on your system, you can use this action to install a module into the version-specific library trees. This means that you can have several versions of the same module installed and C a specific one like this: use only MyModule => 0.55; To override the default installation libraries in C, specify the C parameter when you run the C script: perl Build.PL versionlib=/my/version/place/ To override which version the module is installed as, specify the C parameter when you run the C script: perl Build.PL version=0.50 See the C documentation for more information on version-specific installs. =item manifest This is an action intended for use by module authors, not people installing modules. It will bring the F up to date with the files currently present in the distribution. You may use a F file to exclude certain files or directories from inclusion in the F. F should contain a bunch of regular expressions, one per line. If a file in the distribution directory matches any of the regular expressions, it won't be included in the F. The following is a reasonable F starting point, you can add your own stuff to it: ^_build ^Build$ ^blib ~$ \.bak$ ^MANIFEST\.SKIP$ CVS See the L and L actions if you want to find out what the C action would do, without actually doing anything. =item dist This action is helpful for module authors who want to package up their module for distribution through a medium like CPAN. It will create a tarball of the files listed in F and compress the tarball using GZIP compression. =item distsign Uses C to create a SIGNATURE file for your distribution. =item distmeta Creates the F file for your distribution. =item distcheck Reports which files are in the build directory but not in the F file, and vice versa. (See L for details) =item skipcheck Reports which files are skipped due to the entries in the F file (See L for details) =item distclean Performs the 'realclean' action and then the 'distcheck' action. =item distdir Creates a directory called C<$(DISTNAME)-$(VERSION)> (if that directory already exists, it will be removed first). Then copies all the files listed in the F file to that directory. This directory is what people will see when they download your distribution and unpack it. While performing the 'distdir' action, a file containing various bits of "metadata" will be created. The metadata includes the module's name, version, dependencies, license, and the C flag. This file is created as F in YAML format, so you must have the C module installed in order to create it. You should also ensure that the F file is listed in your F - if it's not, a warning will be issued. =item disttest Performs the 'distdir' action, then switches into that directory and runs a C, followed by the 'build' and 'test' actions in that directory. =item ppd Build a PPD file for your distribution. =back =head2 How Installation Paths are Determined When you invoke Module::Build's C action, it needs to figure out where to install things. The nutshell version of how this works is that default installation locations are determined from F, and they may be overridden by using the C parameter. An C parameter lets you specify an alternative installation root like F, and a C lets you specify a temporary installation directory like F in case you want to create bundled-up installable packages. Natively, Module::Build provides default installation locations for the following types of installable items: =over 4 =item lib Usually pure-Perl module files ending in F<.pm>. =item arch "Architecture-dependent" module files, usually produced by compiling XS, Inline, or similar code. =item script Programs written in pure Perl. In order to improve reuse, try to make these as small as possible - put the code into modules whenever possible. =item bin "Architecture-dependent" executable programs, i.e. compiled C code or something. Pretty rare to see this in a perl distribution, but it happens. =item libdoc Documentation for the stuff in C and C. This is usually generated from the POD in F<.pm> files. Under Unix, these are manual pages belonging to the 'man3' category. =item bindoc Documentation for the stuff in C