Server IP : 103.119.228.120 / Your IP : 3.145.34.237 Web Server : Apache System : Linux v8.techscape8.com 3.10.0-1160.119.1.el7.tuxcare.els2.x86_64 #1 SMP Mon Jul 15 12:09:18 UTC 2024 x86_64 User : nobody ( 99) PHP Version : 5.6.40 Disable Function : shell_exec,symlink,system,exec,proc_get_status,proc_nice,proc_terminate,define_syslog_variables,syslog,openlog,closelog,escapeshellcmd,passthru,ocinum cols,ini_alter,leak,listen,chgrp,apache_note,apache_setenv,debugger_on,debugger_off,ftp_exec,dl,dll,myshellexec,proc_open,socket_bind,proc_close,escapeshellarg,parse_ini_filepopen,fpassthru,exec,passthru,escapeshellarg,escapeshellcmd,proc_close,proc_open,ini_alter,popen,show_source,proc_nice,proc_terminate,proc_get_status,proc_close,pfsockopen,leak,apache_child_terminate,posix_kill,posix_mkfifo,posix_setpgid,posix_setsid,posix_setuid,dl,symlink,shell_exec,system,dl,passthru,escapeshellarg,escapeshellcmd,myshellexec,c99_buff_prepare,c99_sess_put,fpassthru,getdisfunc,fx29exec,fx29exec2,is_windows,disp_freespace,fx29sh_getupdate,fx29_buff_prepare,fx29_sess_put,fx29shexit,fx29fsearch,fx29ftpbrutecheck,fx29sh_tools,fx29sh_about,milw0rm,imagez,sh_name,myshellexec,checkproxyhost,dosyayicek,c99_buff_prepare,c99_sess_put,c99getsource,c99sh_getupdate,c99fsearch,c99shexit,view_perms,posix_getpwuid,posix_getgrgid,posix_kill,parse_perms,parsesort,view_perms_color,set_encoder_input,ls_setcheckboxall,ls_reverse_all,rsg_read,rsg_glob,selfURL,dispsecinfo,unix2DosTime,addFile,system,get_users,view_size,DirFiles,DirFilesWide,DirPrintHTMLHeaders,GetFilesTotal,GetTitles,GetTimeTotal,GetMatchesCount,GetFileMatchesCount,GetResultFiles,fs_copy_dir,fs_copy_obj,fs_move_dir,fs_move_obj,fs_rmdir,SearchText,getmicrotime MySQL : ON | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /usr/local/share/man/man3/ |
Upload File : |
.\" Automatically generated by Pod::Man 2.27 (Pod::Simple 3.28) .\" .\" Standard preamble: .\" ======================================================================== .de Sp \" Vertical space (when we can't use .PP) .if t .sp .5v .if n .sp .. .de Vb \" Begin verbatim text .ft CW .nf .ne \\$1 .. .de Ve \" End verbatim text .ft R .fi .. .\" Set up some character translations and predefined strings. \*(-- will .\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left .\" double quote, and \*(R" will give a right double quote. \*(C+ will .\" give a nicer C++. Capital omega is used to do unbreakable dashes and .\" therefore won't be available. \*(C` and \*(C' expand to `' in nroff, .\" nothing in troff, for use with C<>. .tr \(*W- .ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p' .ie n \{\ . ds -- \(*W- . ds PI pi . if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch . if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\" diablo 12 pitch . ds L" "" . ds R" "" . ds C` "" . ds C' "" 'br\} .el\{\ . ds -- \|\(em\| . ds PI \(*p . ds L" `` . ds R" '' . ds C` . ds C' 'br\} .\" .\" Escape single quotes in literal strings from groff's Unicode transform. .ie \n(.g .ds Aq \(aq .el .ds Aq ' .\" .\" If the F register is turned on, we'll generate index entries on stderr for .\" titles (.TH), headers (.SH), subsections (.SS), items (.Ip), and index .\" entries marked with X<> in POD. Of course, you'll have to process the .\" output yourself in some meaningful fashion. .\" .\" Avoid warning from groff about undefined register 'F'. .de IX .. .nr rF 0 .if \n(.g .if rF .nr rF 1 .if (\n(rF:(\n(.g==0)) \{ . if \nF \{ . de IX . tm Index:\\$1\t\\n%\t"\\$2" .. . if !\nF==2 \{ . nr % 0 . nr F 2 . \} . \} .\} .rr rF .\" .\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2). .\" Fear. Run. Save yourself. No user-serviceable parts. . \" fudge factors for nroff and troff .if n \{\ . ds #H 0 . ds #V .8m . ds #F .3m . ds #[ \f1 . ds #] \fP .\} .if t \{\ . ds #H ((1u-(\\\\n(.fu%2u))*.13m) . ds #V .6m . ds #F 0 . ds #[ \& . ds #] \& .\} . \" simple accents for nroff and troff .if n \{\ . ds ' \& . ds ` \& . ds ^ \& . ds , \& . ds ~ ~ . ds / .\} .if t \{\ . ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u" . ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u' . ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u' . ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u' . ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u' . ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u' .\} . \" troff and (daisy-wheel) nroff accents .ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V' .ds 8 \h'\*(#H'\(*b\h'-\*(#H' .ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#] .ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H' .ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u' .ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#] .ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#] .ds ae a\h'-(\w'a'u*4/10)'e .ds Ae A\h'-(\w'A'u*4/10)'E . \" corrections for vroff .if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u' .if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u' . \" for low resolution devices (crt and lpr) .if \n(.H>23 .if \n(.V>19 \ \{\ . ds : e . ds 8 ss . ds o a . ds d- d\h'-1'\(ga . ds D- D\h'-1'\(hy . ds th \o'bp' . ds Th \o'LP' . ds ae ae . ds Ae AE .\} .rm #[ #] #H #V #F C .\" ======================================================================== .\" .IX Title "Module::Build::API 3" .TH Module::Build::API 3 "2016-08-24" "perl v5.16.3" "User Contributed Perl Documentation" .\" For nroff, turn off justification. Always turn off hyphenation; it makes .\" way too many mistakes in technical documents. .if n .ad l .nh .SH "NAME" Module::Build::API \- API Reference for Module Authors .SH "DESCRIPTION" .IX Header "DESCRIPTION" I list here some of the most important methods in \f(CW\*(C`Module::Build\*(C'\fR. Normally you won't need to deal with these methods unless you want to subclass \f(CW\*(C`Module::Build\*(C'\fR. 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. .SS "\s-1CONSTRUCTORS\s0" .IX Subsection "CONSTRUCTORS" .IP "\fIcurrent()\fR" 4 .IX Item "current()" [version 0.20] .Sp This method returns a reasonable facsimile of the currently-executing \&\f(CW\*(C`Module::Build\*(C'\fR object representing the current build. You can use this object to query its \*(L"\fInotes()\fR\*(R" 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 \f(CW\*(C`perl Build.PL\*(C'\fR, then use their answer during a regression test: .Sp .Vb 3 \& # 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(\*(Aqcolor\*(Aq); \& ... .Ve .Sp The way the \f(CW\*(C`current()\*(C'\fR method is currently implemented, there may be slight differences between the \f(CW$build\fR object in Build.PL and the one in \f(CW\*(C`t/colortest.t\*(C'\fR. It is our goal to minimize these differences in future releases of Module::Build, so please report any anomalies you find. .Sp One important caveat: in its current implementation, \f(CW\*(C`current()\*(C'\fR will \&\fB\s-1NOT\s0\fR work correctly if you have changed out of the directory that \&\f(CW\*(C`Module::Build\*(C'\fR was invoked from. .IP "\fInew()\fR" 4 .IX Item "new()" [version 0.03] .Sp Creates a new Module::Build object. Arguments to the \fInew()\fR method are listed below. Most arguments are optional, but you must provide either the \*(L"module_name\*(R" argument, or \*(L"dist_name\*(R" and one of \&\*(L"dist_version\*(R" or \*(L"dist_version_from\*(R". In other words, you must provide enough information to determine both a distribution name and version. .RS 4 .IP "add_to_cleanup" 4 .IX Item "add_to_cleanup" [version 0.19] .Sp An array reference of files to be cleaned up when the \f(CW\*(C`clean\*(C'\fR action is performed. See also the \fIadd_to_cleanup()\fR method. .IP "allow_pureperl" 4 .IX Item "allow_pureperl" [version 0.4005] .Sp A bool indicating the module is still functional without its xs parts. When an \s-1XS\s0 module is build with \-\-pureperl_only, it will otherwise fail. .IP "auto_configure_requires" 4 .IX Item "auto_configure_requires" [version 0.34] .Sp 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. .IP "auto_features" 4 .IX Item "auto_features" [version 0.26] .Sp This parameter supports the setting of features (see \&\*(L"feature($name)\*(R") automatically based on a set of prerequisites. For instance, for a module that could optionally use either MySQL or PostgreSQL databases, you might use \f(CW\*(C`auto_features\*(C'\fR like this: .Sp .Vb 10 \& my $build = Module::Build\->new \& ( \& ...other stuff here... \& auto_features => { \& pg_support => { \& description => "Interface with Postgres databases", \& requires => { \*(AqDBD::Pg\*(Aq => 23.3, \& \*(AqDateTime::Format::Pg\*(Aq => 0 }, \& }, \& mysql_support => { \& description => "Interface with MySQL databases", \& requires => { \*(AqDBD::mysql\*(Aq => 17.9, \& \*(AqDateTime::Format::MySQL\*(Aq => 0 }, \& }, \& } \& ); .Ve .Sp For each feature named, the required prerequisites will be checked, and if there are no failures, the feature will be enabled (set to \f(CW1\fR). Otherwise the failures will be displayed to the user and the feature will be disabled (set to \f(CW0\fR). .Sp See the documentation for \*(L"requires\*(R" for the details of how requirements can be specified. .IP "autosplit" 4 .IX Item "autosplit" [version 0.04] .Sp An optional \f(CW\*(C`autosplit\*(C'\fR argument specifies a file which should be run through the \fIAutoSplit::autosplit()\fR function. If multiple files should be split, the argument may be given as an array of the files to split. .Sp In general I don't consider autosplitting 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. .IP "build_class" 4 .IX Item "build_class" [version 0.28] .Sp The Module::Build class or subclass to use in the build script. Defaults to \*(L"Module::Build\*(R" or the class name passed to or created by a call to \*(L"\fIsubclass()\fR\*(R". This property is useful if you're writing a custom Module::Build subclass and have a bootstrapping problem\*(--that is, your subclass requires modules that may not be installed when \f(CW\*(C`perl Build.PL\*(C'\fR is executed, but you've listed in \&\*(L"build_requires\*(R" so that they should be available when \f(CW\*(C`./Build\*(C'\fR is executed. .IP "build_requires" 4 .IX Item "build_requires" [version 0.07] .Sp 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. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "configure_requires" 4 .IX Item "configure_requires" [version 0.30] .Sp Modules listed in this section must be installed \fIbefore\fR configuring this distribution (i.e. before running the \fIBuild.PL\fR script). This might be a specific minimum version of \f(CW\*(C`Module::Build\*(C'\fR or any other module the \fIBuild.PL\fR needs in order to do its stuff. Clients like \f(CW\*(C`CPAN.pm\*(C'\fR or \f(CW\*(C`CPANPLUS\*(C'\fR will be expected to pick \&\f(CW\*(C`configure_requires\*(C'\fR out of the \fI\s-1META\s0.yml\fR file and install these items before running the \f(CW\*(C`Build.PL\*(C'\fR. .Sp Module::Build may automatically add itself to configure_requires. See \*(L"auto_configure_requires\*(R" for details. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "test_requires" 4 .IX Item "test_requires" [version 0.4004] .Sp Modules listed in this section must be installed before testing the distribution. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "create_packlist" 4 .IX Item "create_packlist" [version 0.28] .Sp If true, this parameter tells Module::Build to create a \fI.packlist\fR file during the \f(CW\*(C`install\*(C'\fR action, just like \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR does. The file is created in a subdirectory of the \f(CW\*(C`arch\*(C'\fR installation location. It is used by some other tools (\s-1CPAN, CPANPLUS,\s0 etc.) for determining what files are part of an install. .Sp The default value is true. This parameter was introduced in Module::Build version 0.2609; previously no packlists were ever created by Module::Build. .IP "c_source" 4 .IX Item "c_source" [version 0.04] .Sp An optional \f(CW\*(C`c_source\*(C'\fR argument specifies a directory which contains C source files that the rest of the build may depend on. Any \f(CW\*(C`.c\*(C'\fR 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 \s-1XS\s0 files. .Sp [version 0.3604] .Sp A list of directories can be supplied using an anonymous array reference of strings. .IP "conflicts" 4 .IX Item "conflicts" [version 0.07] .Sp Modules listed in this section conflict in some serious way with the given module. \f(CW\*(C`Module::Build\*(C'\fR (or some higher-level tool) will refuse to install the given module if the given module/version is also installed. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "create_license" 4 .IX Item "create_license" [version 0.31] .Sp This parameter tells Module::Build to automatically create a \&\fI\s-1LICENSE\s0\fR file at the top level of your distribution, containing the full text of the author's chosen license. This requires \&\f(CW\*(C`Software::License\*(C'\fR on the author's machine, and further requires that the \f(CW\*(C`license\*(C'\fR parameter specifies a license that it knows about. .IP "create_makefile_pl" 4 .IX Item "create_makefile_pl" [version 0.19] .Sp This parameter lets you use \f(CW\*(C`Module::Build::Compat\*(C'\fR during the \&\f(CW\*(C`distdir\*(C'\fR (or \f(CW\*(C`dist\*(C'\fR) action to automatically create a Makefile.PL for compatibility with \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR. The parameter's value should be one of the styles named in the Module::Build::Compat documentation. .IP "create_readme" 4 .IX Item "create_readme" [version 0.22] .Sp This parameter tells Module::Build to automatically create a \fI\s-1README\s0\fR file at the top level of your distribution. Currently it will simply use \f(CW\*(C`Pod::Text\*(C'\fR (or \f(CW\*(C`Pod::Readme\*(C'\fR if it's installed) on the file indicated by \f(CW\*(C`dist_version_from\*(C'\fR and put the result in the \fI\s-1README\s0\fR file. This is by no means the only recommended style for writing a \&\fI\s-1README\s0\fR, but it seems to be one common one used on the \s-1CPAN.\s0 .Sp If you generate a \fI\s-1README\s0\fR in this way, it's probably a good idea to create a separate \fI\s-1INSTALL\s0\fR file if that information isn't in the generated \fI\s-1README\s0\fR. .IP "dist_abstract" 4 .IX Item "dist_abstract" [version 0.20] .Sp This should be a short description of the distribution. This is used when generating metadata for \fI\s-1META\s0.yml\fR and \s-1PPD\s0 files. If it is not given then \f(CW\*(C`Module::Build\*(C'\fR looks in the \s-1POD\s0 of the module from which it gets the distribution's version. If it finds a \s-1POD\s0 section marked \*(L"=head1 \&\s-1NAME\*(R",\s0 then it looks for the first line matching \f(CW\*(C`\es+\-\es+(.+)\*(C'\fR, and uses the captured text as the abstract. .IP "dist_author" 4 .IX Item "dist_author" [version 0.20] .Sp This should be something like \*(L"John Doe <jdoe@example.com>\*(R", or if there are multiple authors, an anonymous array of strings may be specified. This is used when generating metadata for \fI\s-1META\s0.yml\fR and \&\s-1PPD\s0 files. If this is not specified, then \f(CW\*(C`Module::Build\*(C'\fR looks at the module from which it gets the distribution's version. If it finds a \s-1POD\s0 section marked \*(L"=head1 \s-1AUTHOR\*(R",\s0 then it uses the contents of this section. .IP "dist_name" 4 .IX Item "dist_name" [version 0.11] .Sp Specifies the name for this distribution. Most authors won't need to set this directly, they can use \f(CW\*(C`module_name\*(C'\fR to set \f(CW\*(C`dist_name\*(C'\fR to a reasonable default. However, some agglomerative distributions like \&\f(CW\*(C`libwww\-perl\*(C'\fR or \f(CW\*(C`bioperl\*(C'\fR have names that don't correspond directly to a module name, so \f(CW\*(C`dist_name\*(C'\fR can be set independently. .IP "dist_suffix" 4 .IX Item "dist_suffix" [version 0.37] .Sp Specifies an optional suffix to include after the version number in the distribution directory (and tarball) name. The only suffix currently recognized by \s-1PAUSE\s0 is '\s-1TRIAL\s0', which indicates that the distribution should not be indexed. For example: .Sp .Vb 1 \& Foo\-Bar\-1.23\-TRIAL.tar.gz .Ve .Sp This will automatically do the \*(L"right thing\*(R" depending on \f(CW\*(C`dist_version\*(C'\fR and \&\f(CW\*(C`release_status\*(C'\fR. When \f(CW\*(C`dist_version\*(C'\fR does not have an underscore and \&\f(CW\*(C`release_status\*(C'\fR is not 'stable', then \f(CW\*(C`dist_suffix\*(C'\fR will default to '\s-1TRIAL\s0'. Otherwise it will default to the empty string, disabling the suffix. .Sp In general, authors should only set this if they \fBmust\fR override the default behavior for some particular purpose. .IP "dist_version" 4 .IX Item "dist_version" [version 0.11] .Sp Specifies a version number for the distribution. See \*(L"module_name\*(R" or \*(L"dist_version_from\*(R" for ways to have this set automatically from a \&\f(CW$VERSION\fR variable in a module. One way or another, a version number needs to be set. .IP "dist_version_from" 4 .IX Item "dist_version_from" [version 0.11] .Sp 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\*(R" to set it to a reasonable default. .Sp The version is extracted from the specified file according to the same rules as ExtUtils::MakeMaker and \f(CW\*(C`CPAN.pm\*(C'\fR. It involves finding the first line that matches the regular expression .Sp .Vb 1 \& /([\e$*])(([\ew\e:\e\*(Aq]*)\ebVERSION)\eb.*\e=/ .Ve .Sp \&\fIeval()\fR\-ing that line, then checking the value of the \f(CW$VERSION\fR variable. Quite ugly, really, but all the modules on \s-1CPAN\s0 depend on this process, so there's no real opportunity to change to something better. .Sp If the target file of \*(L"dist_version_from\*(R" contains more than one package declaration, the version returned will be the one matching the configured \&\*(L"module_name\*(R". .IP "dynamic_config" 4 .IX Item "dynamic_config" [version 0.07] .Sp A boolean flag indicating whether the \fIBuild.PL\fR 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 \fI\s-1META\s0.yml\fR spec says that installation tools should treat it as 1 (true), because this is a safer way to behave. .Sp Currently \f(CW\*(C`Module::Build\*(C'\fR doesn't actually do anything with this flag \&\- it's up to higher-level tools like \f(CW\*(C`CPAN.pm\*(C'\fR to do something useful with it. It can potentially bring lots of security, packaging, and convenience improvements. .IP "extra_compiler_flags" 4 .IX Item "extra_compiler_flags" .PD 0 .IP "extra_linker_flags" 4 .IX Item "extra_linker_flags" .PD [version 0.19] .Sp 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: .Sp .Vb 5 \& my $build = Module::Build\->new \& ( \& module_name => \*(AqFoo::Bar\*(Aq, \& extra_compiler_flags => [\*(Aq\-x\*(Aq, \*(Aqc++\*(Aq], \& ); .Ve .Sp To link your \s-1XS\s0 code against glib you might write something like: .Sp .Vb 7 \& my $build = Module::Build\->new \& ( \& module_name => \*(AqFoo::Bar\*(Aq, \& dynamic_config => 1, \& extra_compiler_flags => scalar \`glib\-config \-\-cflags\`, \& extra_linker_flags => scalar \`glib\-config \-\-libs\`, \& ); .Ve .IP "extra_manify_args" 4 .IX Item "extra_manify_args" [version 0.4006] .Sp Any extra arguments to pass to \f(CW\*(C`Pod::Man\->new()\*(C'\fR when building man pages. One common choice might be \f(CW\*(C`utf8 => 1\*(C'\fR to get Unicode support. .IP "get_options" 4 .IX Item "get_options" [version 0.26] .Sp You can pass arbitrary command line options to \fIBuild.PL\fR or \&\fIBuild\fR, and they will be stored in the Module::Build object and can be accessed via the \*(L"\fIargs()\fR\*(R" method. However, sometimes you want more flexibility out of your argument processing than this allows. In such cases, use the \f(CW\*(C`get_options\*(C'\fR parameter to pass in a hash reference of argument specifications, and the list of arguments to \&\fIBuild.PL\fR or \fIBuild\fR will be processed according to those specifications before they're passed on to \f(CW\*(C`Module::Build\*(C'\fR's own argument processing. .Sp The supported option specification hash keys are: .RS 4 .IP "type" 4 .IX Item "type" The type of option. The types are those supported by Getopt::Long; consult its documentation for a complete list. Typical types are \f(CW\*(C`=s\*(C'\fR for strings, \&\f(CW\*(C`+\*(C'\fR for additive options, and \f(CW\*(C`!\*(C'\fR 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. .IP "store" 4 .IX 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 \f(CW\*(C`args()\*(C'\fR method. .IP "default" 4 .IX 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 \&\f(CW\*(C`args()\*(C'\fR. .RE .RS 4 .Sp 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 \f(CW\*(C`args()\*(C'\fR. For example: .Sp .Vb 10 \& my $loud = 0; \& my $build = Module::Build\->new \& ( \& module_name => \*(AqFoo::Bar\*(Aq, \& get_options => { \& Loud => { store => \e$loud }, \& Dbd => { type => \*(Aq=s\*(Aq }, \& Quantity => { type => \*(Aq+\*(Aq }, \& } \& ); \& \& print STDERR "HEY, ARE YOU LISTENING??\en" if $loud; \& print "We\*(Aqll use the ", $build\->args(\*(AqDbd\*(Aq), " DBI driver\en"; \& print "Are you sure you want that many?\en" \& if $build\->args(\*(AqQuantity\*(Aq) > 2; .Ve .Sp The arguments for such a specification can be called like so: .Sp .Vb 1 \& perl Build.PL \-\-Loud \-\-Dbd=DBD::pg \-\-Quantity \-\-Quantity \-\-Quantity .Ve .Sp \&\fB\s-1WARNING:\s0\fR 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. .Sp Consult the Getopt::Long documentation for details on its usage. .RE .IP "include_dirs" 4 .IX Item "include_dirs" [version 0.24] .Sp Specifies any additional directories in which to search for C header files. May be given as a string indicating a single directory, or as a list reference indicating multiple directories. .IP "install_path" 4 .IX Item "install_path" [version 0.19] .Sp You can set paths for individual installable elements by using the \&\f(CW\*(C`install_path\*(C'\fR parameter: .Sp .Vb 8 \& my $build = Module::Build\->new \& ( \& ...other stuff here... \& install_path => { \& lib => \*(Aq/foo/lib\*(Aq, \& arch => \*(Aq/foo/lib/arch\*(Aq, \& } \& ); .Ve .IP "installdirs" 4 .IX Item "installdirs" [version 0.19] .Sp Determines where files are installed within the normal perl hierarchy as determined by \fIConfig.pm\fR. Valid values are: \f(CW\*(C`core\*(C'\fR, \f(CW\*(C`site\*(C'\fR, \&\f(CW\*(C`vendor\*(C'\fR. The default is \f(CW\*(C`site\*(C'\fR. See \&\*(L"\s-1INSTALL PATHS\*(R"\s0 in Module::Build .IP "license" 4 .IX Item "license" [version 0.07] .Sp Specifies the licensing terms of your distribution. .Sp As of Module::Build version 0.36_14, you may use a Software::License subclass name (e.g. 'Apache_2_0') instead of one of the keys below. .Sp The legacy list of valid license values include: .RS 4 .IP "apache" 4 .IX Item "apache" The distribution is licensed under the Apache License, Version 2.0 (<http://apache.org/licenses/LICENSE\-2.0>). .IP "apache_1_1" 4 .IX Item "apache_1_1" The distribution is licensed under the Apache Software License, Version 1.1 (<http://apache.org/licenses/LICENSE\-1.1>). .IP "artistic" 4 .IX Item "artistic" The distribution is licensed under the Artistic License, as specified by the \fIArtistic\fR file in the standard Perl distribution. .IP "artistic_2" 4 .IX Item "artistic_2" The distribution is licensed under the Artistic 2.0 License (<http://opensource.org/licenses/artistic\-license\-2.0.php>.) .IP "bsd" 4 .IX Item "bsd" The distribution is licensed under the \s-1BSD\s0 License (<http://www.opensource.org/licenses/bsd\-license.php>). .IP "gpl" 4 .IX Item "gpl" The distribution is licensed under the terms of the \s-1GNU\s0 General Public License (<http://www.opensource.org/licenses/gpl\-license.php>). .IP "lgpl" 4 .IX Item "lgpl" The distribution is licensed under the terms of the \s-1GNU\s0 Lesser General Public License (<http://www.opensource.org/licenses/lgpl\-license.php>). .IP "mit" 4 .IX Item "mit" The distribution is licensed under the \s-1MIT\s0 License (<http://opensource.org/licenses/mit\-license.php>). .IP "mozilla" 4 .IX Item "mozilla" The distribution is licensed under the Mozilla Public License. (<http://opensource.org/licenses/mozilla1.0.php> or <http://opensource.org/licenses/mozilla1.1.php>) .IP "open_source" 4 .IX Item "open_source" The distribution is licensed under some other Open Source Initiative-approved license listed at <http://www.opensource.org/licenses/>. .IP "perl" 4 .IX 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 \s-1CPAN\s0). This is a dual license, in which the user may choose between either the \s-1GPL\s0 or the Artistic license. .IP "restrictive" 4 .IX Item "restrictive" The distribution may not be redistributed without special permission from the author and/or copyright holder. .IP "unrestricted" 4 .IX Item "unrestricted" The distribution is licensed under a license that is \fBnot\fR approved by www.opensource.org but that allows distribution without restrictions. .RE .RS 4 .Sp Note that you must still include the terms of your license in your code and documentation \- this field only sets the information that is included in distribution metadata to let automated tools figure out your licensing restrictions. Humans still need something to read. If you choose to provide this field, you should make sure that you keep it in sync with your written documentation if you ever change your licensing terms. .Sp You may also use a license type of \f(CW\*(C`unknown\*(C'\fR if you don't wish to specify your terms in the metadata. .Sp Also see the \f(CW\*(C`create_license\*(C'\fR parameter. .RE .IP "meta_add" 4 .IX Item "meta_add" [version 0.28] .Sp A hash of key/value pairs that should be added to the \fI\s-1META\s0.yml\fR file during the \f(CW\*(C`distmeta\*(C'\fR action. Any existing entries with the same names will be overridden. .Sp See the \*(L"\s-1MODULE METADATA\*(R"\s0 section for details. .IP "meta_merge" 4 .IX Item "meta_merge" [version 0.28] .Sp A hash of key/value pairs that should be merged into the \fI\s-1META\s0.yml\fR file during the \f(CW\*(C`distmeta\*(C'\fR action. Any existing entries with the same names will be overridden. .Sp The only difference between \f(CW\*(C`meta_add\*(C'\fR and \f(CW\*(C`meta_merge\*(C'\fR is their behavior on hash-valued and array-valued entries: \f(CW\*(C`meta_add\*(C'\fR will completely blow away the existing hash or array value, but \&\f(CW\*(C`meta_merge\*(C'\fR will merge the supplied data into the existing hash or array value. .Sp See the \*(L"\s-1MODULE METADATA\*(R"\s0 section for details. .IP "module_name" 4 .IX Item "module_name" [version 0.03] .Sp The \f(CW\*(C`module_name\*(C'\fR is a shortcut for setting default values of \&\f(CW\*(C`dist_name\*(C'\fR and \f(CW\*(C`dist_version_from\*(C'\fR, reflecting the fact that the majority of \s-1CPAN\s0 distributions are centered around one \*(L"main\*(R" module. For instance, if you set \f(CW\*(C`module_name\*(C'\fR to \f(CW\*(C`Foo::Bar\*(C'\fR, then \&\f(CW\*(C`dist_name\*(C'\fR will default to \f(CW\*(C`Foo\-Bar\*(C'\fR and \f(CW\*(C`dist_version_from\*(C'\fR will default to \f(CW\*(C`lib/Foo/Bar.pm\*(C'\fR. \f(CW\*(C`dist_version_from\*(C'\fR will in turn be used to set \f(CW\*(C`dist_version\*(C'\fR. .Sp Setting \f(CW\*(C`module_name\*(C'\fR won't override a \f(CW\*(C`dist_*\*(C'\fR parameter you specify explicitly. .IP "needs_compiler" 4 .IX Item "needs_compiler" [version 0.36] .Sp The \f(CW\*(C`needs_compiler\*(C'\fR parameter indicates whether a compiler is required to build the distribution. The default is false, unless \s-1XS\s0 files are found or the \f(CW\*(C`c_source\*(C'\fR parameter is set, in which case it is true. If true, ExtUtils::CBuilder is automatically added to \f(CW\*(C`build_requires\*(C'\fR if needed. .Sp For a distribution where a compiler is \fIoptional\fR, e.g. a dual XS/pure\-Perl distribution, \f(CW\*(C`needs_compiler\*(C'\fR should explicitly be set to a false value. .IP "PL_files" 4 .IX Item "PL_files" [version 0.06] .Sp An optional parameter specifying a set of \f(CW\*(C`.PL\*(C'\fR 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 \&\f(CW\*(C`lib/Foo/Bar.pm.PL\*(C'\fR might create the file \f(CW\*(C`lib/Foo/Bar.pm\*(C'\fR. .Sp The files are specified with the \f(CW\*(C`.PL\*(C'\fR files as hash keys, and the file(s) they generate as hash values, like so: .Sp .Vb 6 \& my $build = Module::Build\->new \& ( \& module_name => \*(AqFoo::Bar\*(Aq, \& ... \& PL_files => { \*(Aqlib/Foo/Bar.pm.PL\*(Aq => \*(Aqlib/Foo/Bar.pm\*(Aq }, \& ); .Ve .Sp Note that the path specifications are \fIalways\fR given in Unix-like format, not in the style of the local system. .Sp If your \f(CW\*(C`.PL\*(C'\fR 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: .Sp .Vb 5 \& PL_files => { \& \*(Aqlib/Foo/Bar.pm.PL\*(Aq => \*(Aqlib/Foo/Bar.pm\*(Aq, \& \*(Aqlib/something.PL\*(Aq => [\*(Aq/lib/something\*(Aq, \*(Aq/lib/else\*(Aq], \& \*(Aqlib/funny.PL\*(Aq => [], \& } .Ve .Sp Here's an example of a simple \s-1PL\s0 file. .Sp .Vb 2 \& my $output_file = shift; \& open my $fh, ">", $output_file or die "Can\*(Aqt open $output_file: $!"; \& \& print $fh <<\*(AqEND\*(Aq; \& #!/usr/bin/perl \& \& print "Hello, world!\en"; \& END .Ve .Sp \&\s-1PL\s0 files are not installed by default, so its safe to put them in \&\fIlib/\fR and \fIbin/\fR. .IP "pm_files" 4 .IX Item "pm_files" [version 0.19] .Sp An optional parameter specifying the set of \f(CW\*(C`.pm\*(C'\fR 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 \*(L"normal\*(R" Module::Build\-style distribution. This parameter is mainly intended to support alternative layouts of files. .Sp For instance, if you have an old-style \f(CW\*(C`MakeMaker\*(C'\fR distribution for a module called \f(CW\*(C`Foo::Bar\*(C'\fR and a \fIBar.pm\fR file at the top level of the distribution, you could specify your layout in your \f(CW\*(C`Build.PL\*(C'\fR like this: .Sp .Vb 6 \& my $build = Module::Build\->new \& ( \& module_name => \*(AqFoo::Bar\*(Aq, \& ... \& pm_files => { \*(AqBar.pm\*(Aq => \*(Aqlib/Foo/Bar.pm\*(Aq }, \& ); .Ve .Sp Note that the values should include \f(CW\*(C`lib/\*(C'\fR, because this is where they would be found in a \*(L"normal\*(R" Module::Build\-style distribution. .Sp Note also that the path specifications are \fIalways\fR given in Unix-like format, not in the style of the local system. .IP "pod_files" 4 .IX Item "pod_files" [version 0.19] .Sp Just like \f(CW\*(C`pm_files\*(C'\fR, but used for specifying the set of \f(CW\*(C`.pod\*(C'\fR files in your distribution. .IP "recommends" 4 .IX Item "recommends" [version 0.08] .Sp This is just like the \*(L"requires\*(R" 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. .Sp 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 may be skipped if recommended dependencies aren't present. .Sp Automated tools like \s-1CPAN\s0.pm should inform the user when recommended modules aren't installed, and it should offer to install them if it wants to be helpful. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "recursive_test_files" 4 .IX Item "recursive_test_files" [version 0.28] .Sp Normally, \f(CW\*(C`Module::Build\*(C'\fR does not search subdirectories when looking for tests to run. When this options is set it will search recursively in all subdirectories of the standard 't' test directory. .IP "release_status" 4 .IX Item "release_status" [version 0.37] .Sp The \s-1CPAN\s0 Meta Spec version 2 adds \f(CW\*(C`release_status\*(C'\fR to allow authors to specify how a distribution should be indexed. Consistent with the spec, this parameter can only have one three values: 'stable', \&'testing' or 'unstable'. .Sp Unless explicitly set by the author, \f(CW\*(C`release_status\*(C'\fR will default to 'stable' unless \f(CW\*(C`dist_version\*(C'\fR contains an underscore, in which case it will default to 'testing'. .Sp It is an error to specify a \f(CW\*(C`release_status\*(C'\fR of 'stable' when \&\f(CW\*(C`dist_version\*(C'\fR contains an underscore character. .IP "requires" 4 .IX Item "requires" [version 0.07] .Sp An optional \f(CW\*(C`requires\*(C'\fR argument specifies any module prerequisites that the current module depends on. .Sp One note: currently \f(CW\*(C`Module::Build\*(C'\fR doesn't actually \fIrequire\fR the user to have dependencies installed, it just strongly urges. In the future we may require it. There's also a \*(L"recommends\*(R" section for things that aren't absolutely required. .Sp Automated tools like \s-1CPAN\s0.pm should refuse to install a module if one of its dependencies isn't satisfied, unless a \*(L"force\*(R" command is given by the user. If the tools are helpful, they should also offer to install the dependencies. .Sp A synonym for \f(CW\*(C`requires\*(C'\fR is \f(CW\*(C`prereq\*(C'\fR, to help succour people transitioning from \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR. The \f(CW\*(C`requires\*(C'\fR term is preferred, but the \f(CW\*(C`prereq\*(C'\fR term will remain valid in future distributions. .Sp See the documentation for \*(L"\s-1PREREQUISITES\*(R"\s0 in Module::Build::Authoring for the details of how requirements can be specified. .IP "script_files" 4 .IX Item "script_files" [version 0.18] .Sp 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, as a hash reference whose keys are the files (and whose values will currently be ignored), as a string giving the name of a directory in which to find scripts, or as a string giving the name of a single script file. .Sp The default is to install any scripts found in a \fIbin\fR directory at the top level of the distribution, minus any keys of PL_files. .Sp For backward compatibility, you may use the parameter \f(CW\*(C`scripts\*(C'\fR instead of \f(CW\*(C`script_files\*(C'\fR. Please consider this usage deprecated, though it will continue to exist for several version releases. .IP "share_dir" 4 .IX Item "share_dir" [version 0.36] .Sp An optional parameter specifying directories of static data files to be installed as read-only files for use with File::ShareDir. The \&\f(CW\*(C`share_dir\*(C'\fR property supports both distribution-level and module-level share files. .Sp The simplest use of \f(CW\*(C`share_dir\*(C'\fR is to set it to a directory name or an arrayref of directory names containing files to be installed in the distribution-level share directory. .Sp .Vb 1 \& share_dir => \*(Aqshare\*(Aq .Ve .Sp Alternatively, if \f(CW\*(C`share_dir\*(C'\fR is a hashref, it may have \f(CW\*(C`dist\*(C'\fR or \&\f(CW\*(C`module\*(C'\fR keys providing full flexibility in defining how share directories should be installed. .Sp .Vb 7 \& share_dir => { \& dist => [ \*(Aqexamples\*(Aq, \*(Aqmore_examples\*(Aq ], \& module => { \& Foo::Templates => [\*(Aqshare/html\*(Aq, \*(Aqshare/text\*(Aq], \& Foo::Config => \*(Aqshare/config\*(Aq, \& } \& } .Ve .Sp If \f(CW\*(C`share_dir\*(C'\fR is set, then File::ShareDir will automatically be added to the \f(CW\*(C`requires\*(C'\fR hash. .IP "sign" 4 .IX Item "sign" [version 0.16] .Sp If a true value is specified for this parameter, Module::Signature will be used (via the 'distsign' action) to create a \s-1SIGNATURE\s0 file for your distribution during the 'distdir' action, and to add the \&\s-1SIGNATURE\s0 file to the \s-1MANIFEST \s0(therefore, don't add it yourself). .Sp The default value is false. In the future, the default may change to true if you have \f(CW\*(C`Module::Signature\*(C'\fR installed on your system. .IP "tap_harness_args" 4 .IX Item "tap_harness_args" [version 0.2808_03] .Sp An optional parameter specifying parameters to be passed to TAP::Harness when running tests. Must be given as a hash reference of parameters; see the TAP::Harness documentation for details. Note that specifying this parameter will implicitly set \f(CW\*(C`use_tap_harness\*(C'\fR to a true value. You must therefore be sure to add TAP::Harness as a requirement for your module in \&\*(L"build_requires\*(R". .IP "test_files" 4 .IX Item "test_files" [version 0.23] .Sp An optional parameter specifying a set of files that should be used as \&\f(CW\*(C`Test::Harness\*(C'\fR\-style regression tests to be run during the \f(CW\*(C`test\*(C'\fR action. 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). If the argument is given as a single string (not in an array reference), that string will be treated as a \f(CW\*(C`glob()\*(C'\fR pattern specifying the files to use. .Sp The default is to look for a \fItest.pl\fR script in the top-level directory of the distribution, and any files matching the glob pattern \&\f(CW\*(C`*.t\*(C'\fR in the \fIt/\fR subdirectory. If the \f(CW\*(C`recursive_test_files\*(C'\fR property is true, then the \f(CW\*(C`t/\*(C'\fR directory will be scanned recursively for \f(CW\*(C`*.t\*(C'\fR files. .IP "use_tap_harness" 4 .IX Item "use_tap_harness" [version 0.2808_03] .Sp An optional parameter indicating whether or not to use TAP::Harness for testing rather than Test::Harness. Defaults to false. If set to true, you must therefore be sure to add TAP::Harness as a requirement for your module in \&\*(L"build_requires\*(R". Implicitly set to a true value if \f(CW\*(C`tap_harness_args\*(C'\fR is specified. .IP "xs_files" 4 .IX Item "xs_files" [version 0.19] .Sp Just like \f(CW\*(C`pm_files\*(C'\fR, but used for specifying the set of \f(CW\*(C`.xs\*(C'\fR files in your distribution. .RE .RS 4 .RE .IP "new_from_context(%args)" 4 .IX Item "new_from_context(%args)" [version 0.28] .Sp When called from a directory containing a \fIBuild.PL\fR script (in other words, the base directory of a distribution), this method will run the \fIBuild.PL\fR and call \f(CW\*(C`resume()\*(C'\fR to return the resulting \f(CW\*(C`Module::Build\*(C'\fR object to the caller. Any key-value arguments given to \f(CW\*(C`new_from_context()\*(C'\fR are essentially like command line arguments given to the \fIBuild.PL\fR script, so for example you could pass \f(CW\*(C`verbose => 1\*(C'\fR to this method to turn on verbosity. .IP "\fIresume()\fR" 4 .IX Item "resume()" [version 0.03] .Sp You'll probably never call this method directly, it's only called from the auto-generated \f(CW\*(C`Build\*(C'\fR script (and the \f(CW\*(C`new_from_context\*(C'\fR method). The \&\f(CW\*(C`new()\*(C'\fR method is only called once, when the user runs \f(CW\*(C`perl Build.PL\*(C'\fR. Thereafter, when the user runs \f(CW\*(C`Build test\*(C'\fR or another action, the \&\f(CW\*(C`Module::Build\*(C'\fR object is created using the \f(CW\*(C`resume()\*(C'\fR method to re-instantiate with the settings given earlier to \f(CW\*(C`new()\*(C'\fR. .IP "\fIsubclass()\fR" 4 .IX Item "subclass()" [version 0.06] .Sp This creates a new \f(CW\*(C`Module::Build\*(C'\fR subclass on the fly, as described in the \*(L"\s-1SUBCLASSING\*(R"\s0 in Module::Build::Authoring section. The caller must provide either a \f(CW\*(C`class\*(C'\fR or \f(CW\*(C`code\*(C'\fR parameter, or both. The \&\f(CW\*(C`class\*(C'\fR parameter indicates the name to use for the new subclass, and defaults to \f(CW\*(C`MyModuleBuilder\*(C'\fR. The \f(CW\*(C`code\*(C'\fR parameter specifies Perl code to use as the body of the subclass. .IP "add_property" 4 .IX Item "add_property" [version 0.31] .Sp .Vb 10 \& package \*(AqMy::Build\*(Aq; \& use base \*(AqModule::Build\*(Aq; \& _\|_PACKAGE_\|_\->add_property( \*(Aqpedantic\*(Aq ); \& _\|_PACKAGE_\|_\->add_property( answer => 42 ); \& _\|_PACKAGE_\|_\->add_property( \& \*(Aqepoch\*(Aq, \& default => sub { time }, \& check => sub { \& return 1 if /^\ed+$/; \& shift\->property_error( "\*(Aq$_\*(Aq is not an epoch time" ); \& return 0; \& }, \& ); .Ve .Sp Adds a property to a Module::Build class. Properties are those attributes of a Module::Build object which can be passed to the constructor and which have accessors to get and set them. All of the core properties, such as \&\f(CW\*(C`module_name\*(C'\fR and \f(CW\*(C`license\*(C'\fR, are defined using this class method. .Sp The first argument to \f(CW\*(C`add_property()\*(C'\fR is always the name of the property. The second argument can be either a default value for the property, or a list of key/value pairs. The supported keys are: .RS 4 .ie n .IP """default""" 4 .el .IP "\f(CWdefault\fR" 4 .IX Item "default" 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.: .Sp .Vb 1 \& default => sub { sub { ... } }, .Ve .ie n .IP """check""" 4 .el .IP "\f(CWcheck\fR" 4 .IX Item "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 \f(CW$_\fR variable. If the value is correct, the \f(CW\*(C`check\*(C'\fR code reference should return true. If the value is not correct, it sends an error message to \&\f(CW\*(C`property_error()\*(C'\fR and returns false. .RE .RS 4 .Sp 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. .Sp .Vb 2 \& print $build\->pedantic, $/; \& $build\->pedantic(0); .Ve .Sp 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: .Sp .Vb 3 \& print "stuff{foo} is: ", $build\->stuff( \*(Aqfoo\*(Aq ), $/; \& $build\->stuff( foo => \*(Aqbar\*(Aq ); \& print $build\->stuff( \*(Aqfoo\*(Aq ), $/; # Outputs "bar" .Ve .Sp Of course, you can still set the entire hash reference at once, as well: .Sp .Vb 1 \& $build\->stuff( { foo => \*(Aqbar\*(Aq, baz => \*(Aqyo\*(Aq } ); .Ve .Sp In either case, if a \f(CW\*(C`check\*(C'\fR has been specified for the property, it will be applied to the entire hash. So the check code reference should look something like: .Sp .Vb 5 \& check => sub { \& return 1 if defined $_ && exists $_\->{foo}; \& shift\->property_error(qq{Property "stuff" needs "foo"}); \& return 0; \& }, .Ve .RE .IP "property_error" 4 .IX Item "property_error" [version 0.31] .SS "\s-1METHODS\s0" .IX Subsection "METHODS" .IP "add_build_element($type)" 4 .IX Item "add_build_element($type)" [version 0.26] .Sp 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 \&\f(CW\*(Aqfoo\*(Aq\fR, then you must also define a method called \&\f(CW\*(C`process_foo_files()\*(C'\fR. .Sp See also \&\*(L"Adding new file types to the build process\*(R" in Module::Build::Cookbook. .IP "add_to_cleanup(@files)" 4 .IX Item "add_to_cleanup(@files)" [version 0.03] .Sp You may call \f(CW\*(C`$self\->add_to_cleanup(@patterns)\*(C'\fR to tell \&\f(CW\*(C`Module::Build\*(C'\fR that certain files should be removed when the user performs the \f(CW\*(C`Build clean\*(C'\fR action. The arguments to the method are patterns suitable for passing to Perl's \f(CW\*(C`glob()\*(C'\fR 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 \fIBuild.PL\fR) and the native format when the names are programmatically generated (e.g. in a testing script). .Sp I decided to provide a dynamic method of the \f(CW$build\fR object, rather than just use a static list of files named in the \fIBuild.PL\fR, 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. .IP "\fIargs()\fR" 4 .IX Item "args()" [version 0.26] .Sp .Vb 4 \& my $args_href = $build\->args; \& my %args = $build\->args; \& my $arg_value = $build\->args($key); \& $build\->args($key, $value); .Ve .Sp This method is the preferred interface for retrieving the arguments passed via command line options to \fIBuild.PL\fR or \fIBuild\fR, minus the Module-Build specific options. .Sp When called 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. .ie n .IP "autosplit_file($from, $to)" 4 .el .IP "autosplit_file($from, \f(CW$to\fR)" 4 .IX Item "autosplit_file($from, $to)" [version 0.28] .Sp Invokes the AutoSplit module on the \f(CW$from\fR file, sending the output to the \f(CW\*(C`lib/auto\*(C'\fR directory inside \f(CW$to\fR. \f(CW$to\fR is typically the \f(CW\*(C`blib/\*(C'\fR directory. .IP "\fIbase_dir()\fR" 4 .IX Item "base_dir()" [version 0.14] .Sp Returns a string containing the root-level directory of this build, i.e. where the \f(CW\*(C`Build.PL\*(C'\fR script and the \f(CW\*(C`lib\*(C'\fR directory can be found. This is usually the same as the current working directory, because the \f(CW\*(C`Build\*(C'\fR script will \f(CW\*(C`chdir()\*(C'\fR into this directory as soon as it begins execution. .IP "\fIbuild_requires()\fR" 4 .IX Item "build_requires()" [version 0.21] .Sp Returns a hash reference indicating the \f(CW\*(C`build_requires\*(C'\fR prerequisites that were passed to the \f(CW\*(C`new()\*(C'\fR method. .ie n .IP "can_action( $action )" 4 .el .IP "can_action( \f(CW$action\fR )" 4 .IX Item "can_action( $action )" Returns a reference to the method that defines \f(CW$action\fR, or false otherwise. This is handy for actions defined (or maybe not!) in subclasses. .Sp [version 0.32_xx] .IP "\fIcbuilder()\fR" 4 .IX Item "cbuilder()" [version 0.2809] .Sp Returns the internal ExtUtils::CBuilder object that can be used for compiling & linking C code. If no such object is available (e.g. if the system has no compiler installed) an exception will be thrown. .ie n .IP "check_installed_status($module, $version)" 4 .el .IP "check_installed_status($module, \f(CW$version\fR)" 4 .IX Item "check_installed_status($module, $version)" [version 0.11] .Sp This method returns a hash reference indicating whether a version dependency on a certain module is satisfied. The \f(CW$module\fR argument is given as a string like \f(CW"Data::Dumper"\fR or \f(CW"perl"\fR, and the \&\f(CW$version\fR argument can take any of the forms described in \*(L"requires\*(R" above. This allows very fine-grained version checking. .Sp The returned hash reference has the following structure: .Sp .Vb 6 \& { \& ok => $whether_the_dependency_is_satisfied, \& have => $version_already_installed, \& need => $version_requested, # Same as incoming $version argument \& message => $informative_error_message, \& } .Ve .Sp If no version of \f(CW$module\fR is currently installed, the \f(CW\*(C`have\*(C'\fR value will be the string \f(CW"<none>"\fR. Otherwise the \f(CW\*(C`have\*(C'\fR value will simply be the version of the installed module. Note that this means that if \f(CW$module\fR is installed but doesn't define a version number, the \f(CW\*(C`have\*(C'\fR value will be \f(CW\*(C`undef\*(C'\fR \- this is why we don't use \f(CW\*(C`undef\*(C'\fR for the case when \f(CW$module\fR isn't installed at all. .Sp This method may be called either as an object method (\f(CW\*(C`$build\->check_installed_status($module, $version)\*(C'\fR) or as a class method (\f(CW\*(C`Module::Build\->check_installed_status($module, $version)\*(C'\fR). .ie n .IP "check_installed_version($module, $version)" 4 .el .IP "check_installed_version($module, \f(CW$version\fR)" 4 .IX Item "check_installed_version($module, $version)" [version 0.05] .Sp Like \fIcheck_installed_status()\fR, but simply returns true or false depending on whether module \&\f(CW$module\fR satisfies the dependency \f(CW$version\fR. .Sp If the check succeeds, the return value is the actual version of \&\f(CW$module\fR installed on the system. This allows you to do the following: .Sp .Vb 6 \& my $installed = $build\->check_installed_version(\*(AqDBI\*(Aq, \*(Aq1.15\*(Aq); \& if ($installed) { \& print "Congratulations, version $installed of DBI is installed.\en"; \& } else { \& die "Sorry, you must install DBI.\en"; \& } .Ve .Sp If the check fails, we return false and set \f(CW$@\fR to an informative error message. .Sp If \f(CW$version\fR is any non-true value (notably zero) and any version of \&\f(CW$module\fR is installed, we return true. In this case, if \f(CW$module\fR doesn't define a version, or if its version is zero, we return the special value \*(L"0 but true\*(R", which is numerically zero, but logically true. .Sp In general you might prefer to use \f(CW\*(C`check_installed_status\*(C'\fR if you need detailed information, or this method if you just need a yes/no answer. .ie n .IP "compare_versions($v1, $op, $v2)" 4 .el .IP "compare_versions($v1, \f(CW$op\fR, \f(CW$v2\fR)" 4 .IX Item "compare_versions($v1, $op, $v2)" [version 0.28] .Sp Compares two module versions \f(CW$v1\fR and \f(CW$v2\fR using the operator \&\f(CW$op\fR, which should be one of Perl's numeric operators like \f(CW\*(C`!=\*(C'\fR or \&\f(CW\*(C`>=\*(C'\fR or the like. We do at least a halfway-decent job of handling versions that aren't strictly numeric, like \f(CW\*(C`0.27_02\*(C'\fR, but exotic stuff will likely cause problems. .Sp In the future, the guts of this method might be replaced with a call out to \f(CW\*(C`version.pm\*(C'\fR. .IP "config($key)" 4 .IX Item "config($key)" .PD 0 .ie n .IP "config($key, $value)" 4 .el .IP "config($key, \f(CW$value\fR)" 4 .IX Item "config($key, $value)" .IP "\fIconfig()\fR [deprecated]" 4 .IX Item "config() [deprecated]" .PD [version 0.22] .Sp With a single argument \f(CW$key\fR, returns the value associated with that key in the \f(CW\*(C`Config.pm\*(C'\fR hash, including any changes the author or user has specified. .Sp With \f(CW$key\fR and \f(CW$value\fR arguments, sets the value for future callers of \f(CW\*(C`config($key)\*(C'\fR. .Sp 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. .IP "config_data($name)" 4 .IX Item "config_data($name)" .PD 0 .ie n .IP "config_data($name => $value)" 4 .el .IP "config_data($name => \f(CW$value\fR)" 4 .IX Item "config_data($name => $value)" .PD [version 0.26] .Sp With a single argument, returns the value of the configuration variable \f(CW$name\fR. With two arguments, sets the given configuration variable to the given value. The value may be any Perl scalar that's serializable with \f(CW\*(C`Data::Dumper\*(C'\fR. For instance, if you write a module that can use a MySQL or PostgreSQL back-end, you might create configuration variables called \f(CW\*(C`mysql_connect\*(C'\fR and \&\f(CW\*(C`postgres_connect\*(C'\fR, and set each to an array of connection parameters for \f(CW\*(C`DBI\->connect()\*(C'\fR. .Sp 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 \f(CW\*(C`...::ConfigData\*(C'\fR module, as \&\f(CW\*(C`...::ConfigData\->config($name)\*(C'\fR. .Sp The \fIfeature()\fR and \f(CW\*(C`config_data()\*(C'\fR methods represent Module::Build's main support for configuration of installed modules. See also \*(L"\s-1SAVING CONFIGURATION INFORMATION\*(R"\s0 in Module::Build::Authoring. .IP "\fIconflicts()\fR" 4 .IX Item "conflicts()" [version 0.21] .Sp Returns a hash reference indicating the \f(CW\*(C`conflicts\*(C'\fR prerequisites that were passed to the \f(CW\*(C`new()\*(C'\fR method. .IP "contains_pod($file) [deprecated]" 4 .IX Item "contains_pod($file) [deprecated]" [version 0.20] .Sp [Deprecated] Please see Module::Metadata instead. .Sp Returns true if the given file appears to contain \s-1POD\s0 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. .IP "copy_if_modified(%parameters)" 4 .IX Item "copy_if_modified(%parameters)" [version 0.19] .Sp Takes the file in the \f(CW\*(C`from\*(C'\fR parameter and copies it to the file in the \f(CW\*(C`to\*(C'\fR parameter, or the directory in the \f(CW\*(C`to_dir\*(C'\fR 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 \&\f(CW\*(C`from\*(C'\fR will be copied into \f(CW\*(C`to_dir\*(C'\fR; an optional \f(CW\*(C`flatten\*(C'\fR parameter will copy into \f(CW\*(C`to_dir\*(C'\fR without doing so. .Sp Returns the path to the destination file, or \f(CW\*(C`undef\*(C'\fR if nothing needed to be copied. .Sp Any directories that need to be created in order to perform the copying will be automatically created. .Sp 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. .IP "\fIcreate_build_script()\fR" 4 .IX Item "create_build_script()" [version 0.05] .Sp Creates an executable script called \f(CW\*(C`Build\*(C'\fR 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 \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR. This method also creates some temporary data in a directory called \f(CW\*(C`_build/\*(C'\fR. Both of these will be removed when the \f(CW\*(C`realclean\*(C'\fR action is performed. .Sp Among the files created in \f(CW\*(C`_build/\*(C'\fR is a \fI_build/prereqs\fR file containing the set of prerequisites for this distribution, as a hash of hashes. This file may be \f(CW\*(C`eval()\*(C'\fR\-ed to obtain the authoritative set of prerequisites, which might be different from the contents of \&\fI\s-1META\s0.yml\fR (because \fIBuild.PL\fR might have set them dynamically). But fancy developers take heed: do not put any fancy custom runtime code in the \fI_build/prereqs\fR file, leave it as a static declaration containing only strings and numbers. Similarly, do not alter the structure of the internal \f(CW\*(C`$self\->{properties}{requires}\*(C'\fR (etc.) data members, because that's where this data comes from. .IP "\fIcurrent_action()\fR" 4 .IX Item "current_action()" [version 0.28] .Sp Returns the name of the currently-running action, such as \*(L"build\*(R" or \&\*(L"test\*(R". This action is not necessarily the action that was originally invoked by the user. For example, if the user invoked the \*(L"test\*(R" action, \fIcurrent_action()\fR would initially return \*(L"test\*(R". However, action \*(L"test\*(R" depends on action \*(L"code\*(R", so \fIcurrent_action()\fR will return \*(L"code\*(R" while that dependency is being executed. Once that action has completed, \fIcurrent_action()\fR will again return \*(L"test\*(R". .Sp If you need to know the name of the original action invoked by the user, see \*(L"\fIinvoked_action()\fR\*(R" below. .IP "depends_on(@actions)" 4 .IX Item "depends_on(@actions)" [version 0.28] .Sp Invokes the named action or list of actions in sequence. Using this method is preferred to calling the action explicitly because it performs some internal record-keeping, and it ensures that the same action is not invoked multiple times (note: in future versions of Module::Build it's conceivable that this run-only-once mechanism will be changed to something more intelligent). .Sp Note that the name of this method is something of a misnomer; it should really be called something like \&\f(CW\*(C`invoke_actions_unless_already_invoked()\*(C'\fR or something, but for better or worse (perhaps better!) we were still thinking in \&\f(CW\*(C`make\*(C'\fR\-like dependency terms when we created this method. .Sp See also \fIdispatch()\fR. The main distinction between the two is that \f(CW\*(C`depends_on()\*(C'\fR is meant to call an action from inside another action, whereas \f(CW\*(C`dispatch()\*(C'\fR is meant to set the very top action in motion. .ie n .IP "dir_contains($first_dir, $second_dir)" 4 .el .IP "dir_contains($first_dir, \f(CW$second_dir\fR)" 4 .IX Item "dir_contains($first_dir, $second_dir)" [version 0.28] .Sp Returns true if the first directory logically contains the second directory. This is just a convenience function because \f(CW\*(C`File::Spec\*(C'\fR doesn't really provide an easy way to figure this out (but \&\f(CW\*(C`Path::Class\*(C'\fR does...). .ie n .IP "dispatch($action, %args)" 4 .el .IP "dispatch($action, \f(CW%args\fR)" 4 .IX Item "dispatch($action, %args)" [version 0.03] .Sp Invokes the build action \f(CW$action\fR. 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. .Sp Custom options that have not been registered must be passed in as a hash reference in a key named \*(L"args\*(R": .Sp .Vb 1 \& $build\->dispatch(\*(Aqfoo\*(Aq, verbose => 1, args => { my_option => \*(Aqvalue\*(Aq }); .Ve .Sp 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. .Sp See also \fIdepends_on()\fR. The main distinction between the two is that \f(CW\*(C`depends_on()\*(C'\fR is meant to call an action from inside another action, whereas \f(CW\*(C`dispatch()\*(C'\fR is meant to set the very top action in motion. .IP "\fIdist_dir()\fR" 4 .IX Item "dist_dir()" [version 0.28] .Sp Returns the name of the directory that will be created during the \&\f(CW\*(C`dist\*(C'\fR action. The name is derived from the \f(CW\*(C`dist_name\*(C'\fR and \&\f(CW\*(C`dist_version\*(C'\fR properties. .IP "\fIdist_name()\fR" 4 .IX Item "dist_name()" [version 0.21] .Sp Returns the name of the current distribution, as passed to the \&\f(CW\*(C`new()\*(C'\fR method in a \f(CW\*(C`dist_name\*(C'\fR or modified \f(CW\*(C`module_name\*(C'\fR parameter. .IP "\fIdist_version()\fR" 4 .IX Item "dist_version()" [version 0.21] .Sp Returns the version of the current distribution, as determined by the \&\f(CW\*(C`new()\*(C'\fR method from a \f(CW\*(C`dist_version\*(C'\fR, \f(CW\*(C`dist_version_from\*(C'\fR, or \&\f(CW\*(C`module_name\*(C'\fR parameter. .ie n .IP "do_system($cmd, @args)" 4 .el .IP "do_system($cmd, \f(CW@args\fR)" 4 .IX Item "do_system($cmd, @args)" [version 0.21] .Sp This is a fairly simple wrapper around Perl's \f(CW\*(C`system()\*(C'\fR built-in command. Given a command and an array of optional arguments, this method will print the command to \f(CW\*(C`STDOUT\*(C'\fR, and then execute it using Perl's \f(CW\*(C`system()\*(C'\fR. It returns true or false to indicate success or failure (the opposite of how \f(CW\*(C`system()\*(C'\fR works, but more intuitive). .Sp Note that if you supply a single argument to \f(CW\*(C`do_system()\*(C'\fR, 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. .IP "\fIextra_compiler_flags()\fR" 4 .IX Item "extra_compiler_flags()" .PD 0 .IP "extra_compiler_flags(@flags)" 4 .IX Item "extra_compiler_flags(@flags)" .PD [version 0.25] .Sp Set or retrieve the extra compiler flags. Returns an arrayref of flags. .IP "\fIextra_linker_flags()\fR" 4 .IX Item "extra_linker_flags()" .PD 0 .IP "extra_linker_flags(@flags)" 4 .IX Item "extra_linker_flags(@flags)" .PD [version 0.25] .Sp Set or retrieve the extra linker flags. Returns an arrayref of flags. .IP "feature($name)" 4 .IX Item "feature($name)" .PD 0 .ie n .IP "feature($name => $value)" 4 .el .IP "feature($name => \f(CW$value\fR)" 4 .IX Item "feature($name => $value)" .PD [version 0.26] .Sp 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 \*(L"feature\*(R" 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 \f(CW\*(C`mysql_support\*(C'\fR and \f(CW\*(C`postgres_support\*(C'\fR, and set them to true/false depending on whether the user has the proper databases installed and configured. .Sp 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 \f(CW\*(C`...::ConfigData\*(C'\fR module, as \&\f(CW\*(C`...::ConfigData\->feature($name)\*(C'\fR. .Sp The \f(CW\*(C`feature()\*(C'\fR and \f(CW\*(C`config_data()\*(C'\fR methods represent Module::Build's main support for configuration of installed modules. See also \*(L"\s-1SAVING CONFIGURATION INFORMATION\*(R"\s0 in Module::Build::Authoring. .IP "fix_shebang_line(@files)" 4 .IX Item "fix_shebang_line(@files)" [version 0.??] .Sp Modify any \*(L"shebang\*(R" 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 "\f(CW\*(C`perl\*(C'\fR"; arguments to the command do not count. In particular, this means that the use of \f(CW\*(C`#!/usr/bin/env perl\*(C'\fR will not be changed. .Sp For an explanation of shebang lines, see <http://en.wikipedia.org/wiki/Shebang_%28Unix%29>. .IP "\fIhave_c_compiler()\fR" 4 .IX Item "have_c_compiler()" [version 0.21] .Sp 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. .IP "\fIinstall_base_relpaths()\fR" 4 .IX Item "install_base_relpaths()" .PD 0 .IP "install_base_relpaths($type)" 4 .IX Item "install_base_relpaths($type)" .ie n .IP "install_base_relpaths($type => $path)" 4 .el .IP "install_base_relpaths($type => \f(CW$path\fR)" 4 .IX Item "install_base_relpaths($type => $path)" .PD [version 0.28] .Sp Set or retrieve the relative paths that are appended to \&\f(CW\*(C`install_base\*(C'\fR for any installable element. This is useful if you want to set the relative install path for custom build elements. .Sp 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. .Sp The single argument form returns the value associated with the element \f(CW$type\fR. .Sp The multiple argument form allows you to set the paths for element types. \&\f(CW$value\fR must be a relative path using Unix-like paths. (A series of directories separated by slashes, e.g. \f(CW\*(C`foo/bar\*(C'\fR.) The return value is a localized path based on \f(CW$value\fR. .Sp Assigning the value \f(CW\*(C`undef\*(C'\fR to an element causes it to be removed. .IP "install_destination($type)" 4 .IX Item "install_destination($type)" [version 0.28] .Sp Returns the directory in which items of type \f(CW$type\fR (e.g. \f(CW\*(C`lib\*(C'\fR, \&\f(CW\*(C`arch\*(C'\fR, \f(CW\*(C`bin\*(C'\fR, or anything else returned by the \*(L"\fIinstall_types()\fR\*(R" method) will be installed during the \f(CW\*(C`install\*(C'\fR action. Any settings for \f(CW\*(C`install_path\*(C'\fR, \f(CW\*(C`install_base\*(C'\fR, and \f(CW\*(C`prefix\*(C'\fR are taken into account when determining the return value. .IP "\fIinstall_path()\fR" 4 .IX Item "install_path()" .PD 0 .IP "install_path($type)" 4 .IX Item "install_path($type)" .ie n .IP "install_path($type => $path)" 4 .el .IP "install_path($type => \f(CW$path\fR)" 4 .IX Item "install_path($type => $path)" .PD [version 0.28] .Sp Set or retrieve paths for specific installable elements. This is useful when you want to examine any explicit install paths specified by the user on the command line, or if you want to set the install path for a specific installable element based on another attribute like \f(CW\*(C`install_base()\*(C'\fR. .Sp 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. .Sp The single argument form returns the value associated with the element \f(CW$type\fR. .Sp The multiple argument form allows you to set the paths for element types. The supplied \f(CW$path\fR should be an absolute path to install elements of \f(CW$type\fR. The return value is \f(CW$path\fR. .Sp Assigning the value \f(CW\*(C`undef\*(C'\fR to an element causes it to be removed. .IP "\fIinstall_types()\fR" 4 .IX Item "install_types()" [version 0.28] .Sp Returns a list of installable types that this build knows about. These types each correspond to the name of a directory in \fIblib/\fR, and the list usually includes items such as \f(CW\*(C`lib\*(C'\fR, \f(CW\*(C`arch\*(C'\fR, \f(CW\*(C`bin\*(C'\fR, \&\f(CW\*(C`script\*(C'\fR, \f(CW\*(C`libdoc\*(C'\fR, \f(CW\*(C`bindoc\*(C'\fR, and if \s-1HTML\s0 documentation is to be built, \f(CW\*(C`libhtml\*(C'\fR and \f(CW\*(C`binhtml\*(C'\fR. Other user-defined types may also exist. .IP "\fIinvoked_action()\fR" 4 .IX Item "invoked_action()" [version 0.28] .Sp This is the name of the original action invoked by the user. This value is set when the user invokes \fIBuild.PL\fR, the \fIBuild\fR script, or programmatically through the \fIdispatch()\fR method. It does not change as sub-actions are executed as dependencies are evaluated. .Sp To get the name of the currently executing dependency, see \&\*(L"\fIcurrent_action()\fR\*(R" above. .IP "\fInotes()\fR" 4 .IX Item "notes()" .PD 0 .IP "notes($key)" 4 .IX Item "notes($key)" .ie n .IP "notes($key => $value)" 4 .el .IP "notes($key => \f(CW$value\fR)" 4 .IX Item "notes($key => $value)" .PD [version 0.20] .Sp The \f(CW\*(C`notes()\*(C'\fR 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 \&\f(CW\*(C`current()\*(C'\fR method. .Sp The \f(CW\*(C`notes()\*(C'\fR method is essentially a glorified hash access. With no arguments, \f(CW\*(C`notes()\*(C'\fR returns the entire hash of notes. With one argument, \&\f(CW\*(C`notes($key)\*(C'\fR returns the value associated with the given key. With two arguments, \f(CW\*(C`notes($key, $value)\*(C'\fR sets the value associated with the given key to \f(CW$value\fR and returns the new value. .Sp The lifetime of the \f(CW\*(C`notes\*(C'\fR data is for \*(L"a build\*(R" \- that is, the \&\f(CW\*(C`notes\*(C'\fR hash is created when \f(CW\*(C`perl Build.PL\*(C'\fR is run (or when the \&\f(CW\*(C`new()\*(C'\fR method is run, if the Module::Build Perl \s-1API\s0 is being used instead of called from a shell), and lasts until \f(CW\*(C`perl Build.PL\*(C'\fR is run again or the \f(CW\*(C`clean\*(C'\fR action is run. .IP "\fIorig_dir()\fR" 4 .IX Item "orig_dir()" [version 0.28] .Sp Returns a string containing the working directory that was in effect before the \fIBuild\fR script \fIchdir()\fR\-ed into the \f(CW\*(C`base_dir\*(C'\fR. This might be useful for writing wrapper tools that might need to \fIchdir()\fR back out. .IP "\fIos_type()\fR" 4 .IX Item "os_type()" [version 0.04] .Sp 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, \s-1VMS,\s0 etc., and not the fine-grained value of Perl's \f(CW$^O\fR variable. The \f(CW\*(C`os_type()\*(C'\fR method will return a string like \f(CW\*(C`Windows\*(C'\fR, \f(CW\*(C`Unix\*(C'\fR, \f(CW\*(C`MacOS\*(C'\fR, \f(CW\*(C`VMS\*(C'\fR, or whatever is appropriate. If you're running on an unknown platform, it will return \f(CW\*(C`undef\*(C'\fR \- there shouldn't be many unknown platforms though. .IP "\fIis_vmsish()\fR" 4 .IX Item "is_vmsish()" .PD 0 .IP "\fIis_windowsish()\fR" 4 .IX Item "is_windowsish()" .IP "\fIis_unixish()\fR" 4 .IX Item "is_unixish()" .PD Convenience functions that return a boolean value indicating whether this platform behaves respectively like \s-1VMS,\s0 Windows, or Unix. For arbitrary reasons other platforms don't get their own such functions, at least not yet. .IP "\fIprefix_relpaths()\fR" 4 .IX Item "prefix_relpaths()" .PD 0 .IP "prefix_relpaths($installdirs)" 4 .IX Item "prefix_relpaths($installdirs)" .ie n .IP "prefix_relpaths($installdirs, $type)" 4 .el .IP "prefix_relpaths($installdirs, \f(CW$type\fR)" 4 .IX Item "prefix_relpaths($installdirs, $type)" .ie n .IP "prefix_relpaths($installdirs, $type => $path)" 4 .el .IP "prefix_relpaths($installdirs, \f(CW$type\fR => \f(CW$path\fR)" 4 .IX Item "prefix_relpaths($installdirs, $type => $path)" .PD [version 0.28] .Sp Set or retrieve the relative paths that are appended to \f(CW\*(C`prefix\*(C'\fR for any installable element. This is useful if you want to set the relative install path for custom build elements. .Sp With no argument, it returns a reference to a hash containing all elements and their respective values as defined by the current \&\f(CW\*(C`installdirs\*(C'\fR setting. .Sp With a single argument, it returns a reference to a hash containing all elements and their respective values as defined by \&\f(CW$installdirs\fR. .Sp The hash returned by the above calls should not be modified directly; use the three-argument below form to change values. .Sp The two argument form returns the value associated with the element \f(CW$type\fR. .Sp The multiple argument form allows you to set the paths for element types. \&\f(CW$value\fR must be a relative path using Unix-like paths. (A series of directories separated by slashes, e.g. \f(CW\*(C`foo/bar\*(C'\fR.) The return value is a localized path based on \f(CW$value\fR. .Sp Assigning the value \f(CW\*(C`undef\*(C'\fR to an element causes it to be removed. .IP "\fIget_metadata()\fR" 4 .IX Item "get_metadata()" [version 0.36] .Sp This method returns a hash reference of metadata that can be used to create a \&\s-1YAML\s0 datastream. It is provided for authors to override or customize the fields of \fI\s-1META\s0.yml\fR. E.g. .Sp .Vb 2 \& package My::Builder; \& use base \*(AqModule::Build\*(Aq; \& \& sub get_metadata { \& my $self, @args = @_; \& my $data = $self\->SUPER::get_metadata(@args); \& $data\->{custom_field} = \*(Aqfoo\*(Aq; \& return $data; \& } .Ve .Sp Valid arguments include: .RS 4 .IP "\(bu" 4 \&\f(CW\*(C`fatal\*(C'\fR \*(-- indicates whether missing required metadata fields should be a fatal error or not. For \s-1META\s0 creation, it generally should, but for \s-1MYMETA\s0 creation for end-users, it should not be fatal. .IP "\(bu" 4 \&\f(CW\*(C`auto\*(C'\fR \*(-- indicates whether any necessary configure_requires should be automatically added. This is used in \s-1META\s0 creation. .RE .RS 4 .Sp This method is a wrapper around the old prepare_metadata \s-1API\s0 now that we no longer use YAML::Node to hold metadata. .RE .IP "\fIprepare_metadata()\fR [deprecated]" 4 .IX Item "prepare_metadata() [deprecated]" [version 0.36] .Sp [Deprecated] As of 0.36, authors should use \f(CW\*(C`get_metadata\*(C'\fR instead. This method is preserved for backwards compatibility only. .Sp It takes three positional arguments: a hashref (to which metadata will be added), an optional arrayref (to which metadata keys will be added in order if the arrayref exists), and a hashref of arguments (as provided to get_metadata). The latter argument is new as of 0.36. Earlier versions are always fatal on errors. .Sp Prior to version 0.36, this method took a YAML::Node as an argument to hold assembled metadata. .IP "\fIprereq_failures()\fR" 4 .IX Item "prereq_failures()" [version 0.11] .Sp Returns a data structure containing information about any failed prerequisites (of any of the types described above), or \f(CW\*(C`undef\*(C'\fR if all prerequisites are met. .Sp The data structure returned is a hash reference. The top level keys are the type of prerequisite failed, one of \*(L"requires\*(R", \&\*(L"build_requires\*(R", \*(L"conflicts\*(R", or \*(L"recommends\*(R". 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: .Sp .Vb 5 \& { \& have => \*(Aq0.42\*(Aq, \& need => \*(Aq0.59\*(Aq, \& message => \*(AqVersion 0.42 is installed, but we need version 0.59\*(Aq, \& } .Ve .Sp or .Sp .Vb 5 \& { \& have => \*(Aq<none>\*(Aq, \& need => \*(Aq0.59\*(Aq, \& message => \*(AqPrerequisite Foo isn\*(Aqt installed\*(Aq, \& } .Ve .Sp This hash has the same structure as the hash returned by the \&\f(CW\*(C`check_installed_status()\*(C'\fR method, except that in the case of \&\*(L"conflicts\*(R" dependencies we change the \*(L"need\*(R" key to \*(L"conflicts\*(R" and construct a proper message. .Sp Examples: .Sp .Vb 2 \& # 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}\en"; \& } \& } .Ve .IP "\fIprereq_data()\fR" 4 .IX Item "prereq_data()" [version 0.32] .Sp Returns a reference to a hash describing all prerequisites. The keys of the hash will be the various prerequisite types ('requires', 'build_requires', \&'test_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 \f(CW\*(C`prereq_data\*(C'\fR action is just a thin wrapper around the \f(CW\*(C`prereq_data()\*(C'\fR method and dumps the hash as a string that can be loaded using \f(CW\*(C`eval()\*(C'\fR. .IP "\fIprereq_report()\fR" 4 .IX Item "prereq_report()" [version 0.28] .Sp 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 \f(CW\*(C`prereq_report\*(C'\fR action is just a thin wrapper around the \&\f(CW\*(C`prereq_report()\*(C'\fR method. .ie n .IP "prompt($message, $default)" 4 .el .IP "prompt($message, \f(CW$default\fR)" 4 .IX Item "prompt($message, $default)" [version 0.12] .Sp 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, \f(CW"Where do you keep your money?"\fR). The second argument, which is optional, specifies a default answer (for example, \&\f(CW"wallet"\fR). The user will be asked the question once. .Sp If \f(CW\*(C`prompt()\*(C'\fR detects that it is not running interactively and there is nothing on \s-1STDIN\s0 or if the \s-1PERL_MM_USE_DEFAULT\s0 environment variable is set to true, the \f(CW$default\fR will be used without prompting. .Sp To prevent automated processes from blocking, the user must either set \&\s-1PERL_MM_USE_DEFAULT\s0 or attach something to \s-1STDIN \s0(this can be a pipe/file containing a scripted set of answers or /dev/null.) .Sp If no \f(CW$default\fR is provided an empty string will be used instead. In non-interactive mode, the absence of \f(CW$default\fR is an error (though explicitly passing \f(CW\*(C`undef()\*(C'\fR as the default is valid as of 0.27.) .Sp This method may be called as a class or object method. .IP "\fIrecommends()\fR" 4 .IX Item "recommends()" [version 0.21] .Sp Returns a hash reference indicating the \f(CW\*(C`recommends\*(C'\fR prerequisites that were passed to the \f(CW\*(C`new()\*(C'\fR method. .IP "\fIrequires()\fR" 4 .IX Item "requires()" [version 0.21] .Sp Returns a hash reference indicating the \f(CW\*(C`requires\*(C'\fR prerequisites that were passed to the \f(CW\*(C`new()\*(C'\fR method. .ie n .IP "rscan_dir($dir, $pattern)" 4 .el .IP "rscan_dir($dir, \f(CW$pattern\fR)" 4 .IX Item "rscan_dir($dir, $pattern)" [version 0.28] .Sp Uses \f(CW\*(C`File::Find\*(C'\fR to traverse the directory \f(CW$dir\fR, returning a reference to an array of entries matching \f(CW$pattern\fR. \f(CW$pattern\fR may either be a regular expression (using \f(CW\*(C`qr//\*(C'\fR or just a plain string), or a reference to a subroutine that will return true for wanted entries. If \f(CW$pattern\fR is not given, all entries will be returned. .Sp Examples: .Sp .Vb 2 \& # All the *.pm files in lib/ \& $m\->rscan_dir(\*(Aqlib\*(Aq, qr/\e.pm$/) \& \& # All the files in blib/ that aren\*(Aqt *.html files \& $m\->rscan_dir(\*(Aqblib\*(Aq, sub {\-f $_ and not /\e.html$/}); \& \& # All the files in t/ \& $m\->rscan_dir(\*(Aqt\*(Aq); .Ve .IP "\fIruntime_params()\fR" 4 .IX Item "runtime_params()" .PD 0 .IP "runtime_params($key)" 4 .IX Item "runtime_params($key)" .PD [version 0.28] .Sp The \f(CW\*(C`runtime_params()\*(C'\fR method stores the values passed on the command line for valid properties (that is, any command line options for which \&\f(CW\*(C`valid_property()\*(C'\fR 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 \f(CW\*(C`new()\*(C'\fR. This allows you to programmatically tell if \f(CW\*(C`perl Build.PL\*(C'\fR or any execution of \f(CW\*(C`./Build\*(C'\fR had command line options specified that override valid properties. .Sp The \f(CW\*(C`runtime_params()\*(C'\fR method is essentially a glorified read-only hash. With no arguments, \f(CW\*(C`runtime_params()\*(C'\fR returns the entire hash of properties specified on the command line. With one argument, \f(CW\*(C`runtime_params($key)\*(C'\fR returns the value associated with the given key. .Sp The lifetime of the \f(CW\*(C`runtime_params\*(C'\fR data is for \*(L"a build\*(R" \- that is, the \&\f(CW\*(C`runtime_params\*(C'\fR hash is created when \f(CW\*(C`perl Build.PL\*(C'\fR is run (or when the \&\f(CW\*(C`new()\*(C'\fR method is called, if the Module::Build Perl \s-1API\s0 is being used instead of called from a shell), and lasts until \f(CW\*(C`perl Build.PL\*(C'\fR is run again or the \&\f(CW\*(C`clean\*(C'\fR action is run. .IP "\fIscript_files()\fR" 4 .IX Item "script_files()" [version 0.18] .Sp Returns a hash reference whose keys are the perl script files to be installed, if any. This corresponds to the \f(CW\*(C`script_files\*(C'\fR parameter to the \&\f(CW\*(C`new()\*(C'\fR method. With an optional argument, this parameter may be set dynamically. .Sp For backward compatibility, the \f(CW\*(C`scripts()\*(C'\fR method does exactly the same thing as \f(CW\*(C`script_files()\*(C'\fR. \f(CW\*(C`scripts()\*(C'\fR is deprecated, but it will stay around for several versions to give people time to transition. .ie n .IP "up_to_date($source_file, $derived_file)" 4 .el .IP "up_to_date($source_file, \f(CW$derived_file\fR)" 4 .IX Item "up_to_date($source_file, $derived_file)" .PD 0 .IP "up_to_date(\e@source_files, \e@derived_files)" 4 .IX Item "up_to_date(@source_files, @derived_files)" .PD [version 0.20] .Sp 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. .Sp The arguments may be either a scalar or an array reference of file names. .ie n .IP "y_n($message, $default)" 4 .el .IP "y_n($message, \f(CW$default\fR)" 4 .IX Item "y_n($message, $default)" [version 0.12] .Sp Asks the user a yes/no question using \f(CW\*(C`prompt()\*(C'\fR and returns true or false accordingly. The user will be asked the question repeatedly until they give an answer that looks like \*(L"yes\*(R" or \*(L"no\*(R". .Sp The first argument specifies the message to display to the user (for example, \f(CW"Shall I invest your money for you?"\fR), and the second argument specifies the default answer (for example, \f(CW"y"\fR). .Sp Note that the default is specified as a string like \f(CW"y"\fR or \f(CW"n"\fR, 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. .Sp This method may be called as a class or object method. .SS "Autogenerated Accessors" .IX Subsection "Autogenerated Accessors" In addition to the aforementioned methods, there are also some get/set accessor methods for the following properties: .IP "\fIPL_files()\fR" 4 .IX Item "PL_files()" .PD 0 .IP "\fIallow_mb_mismatch()\fR" 4 .IX Item "allow_mb_mismatch()" .IP "\fIallow_pureperl()\fR" 4 .IX Item "allow_pureperl()" .IP "\fIauto_configure_requires()\fR" 4 .IX Item "auto_configure_requires()" .IP "\fIautosplit()\fR" 4 .IX Item "autosplit()" .IP "\fIbase_dir()\fR" 4 .IX Item "base_dir()" .IP "\fIbindoc_dirs()\fR" 4 .IX Item "bindoc_dirs()" .IP "\fIblib()\fR" 4 .IX Item "blib()" .IP "\fIbuild_bat()\fR" 4 .IX Item "build_bat()" .IP "\fIbuild_class()\fR" 4 .IX Item "build_class()" .IP "\fIbuild_elements()\fR" 4 .IX Item "build_elements()" .IP "\fIbuild_requires()\fR" 4 .IX Item "build_requires()" .IP "\fIbuild_script()\fR" 4 .IX Item "build_script()" .IP "\fIbundle_inc()\fR" 4 .IX Item "bundle_inc()" .IP "\fIbundle_inc_preload()\fR" 4 .IX Item "bundle_inc_preload()" .IP "\fIc_source()\fR" 4 .IX Item "c_source()" .IP "\fIconfig_dir()\fR" 4 .IX Item "config_dir()" .IP "\fIconfigure_requires()\fR" 4 .IX Item "configure_requires()" .IP "\fIconflicts()\fR" 4 .IX Item "conflicts()" .IP "\fIcover()\fR" 4 .IX Item "cover()" .IP "\fIcpan_client()\fR" 4 .IX Item "cpan_client()" .IP "\fIcreate_license()\fR" 4 .IX Item "create_license()" .IP "\fIcreate_makefile_pl()\fR" 4 .IX Item "create_makefile_pl()" .IP "\fIcreate_packlist()\fR" 4 .IX Item "create_packlist()" .IP "\fIcreate_readme()\fR" 4 .IX Item "create_readme()" .IP "\fIdebug()\fR" 4 .IX Item "debug()" .IP "\fIdebugger()\fR" 4 .IX Item "debugger()" .IP "\fIdestdir()\fR" 4 .IX Item "destdir()" .IP "\fIdynamic_config()\fR" 4 .IX Item "dynamic_config()" .IP "\fIextra_manify_args()\fR" 4 .IX Item "extra_manify_args()" .IP "\fIget_options()\fR" 4 .IX Item "get_options()" .IP "\fIhtml_css()\fR" 4 .IX Item "html_css()" .IP "\fIinclude_dirs()\fR" 4 .IX Item "include_dirs()" .IP "\fIinstall_base()\fR" 4 .IX Item "install_base()" .IP "\fIinstalldirs()\fR" 4 .IX Item "installdirs()" .IP "\fIlibdoc_dirs()\fR" 4 .IX Item "libdoc_dirs()" .IP "\fIlicense()\fR" 4 .IX Item "license()" .IP "\fImagic_number()\fR" 4 .IX Item "magic_number()" .IP "\fImb_version()\fR" 4 .IX Item "mb_version()" .IP "\fImeta_add()\fR" 4 .IX Item "meta_add()" .IP "\fImeta_merge()\fR" 4 .IX Item "meta_merge()" .IP "\fImetafile()\fR" 4 .IX Item "metafile()" .IP "\fImetafile2()\fR" 4 .IX Item "metafile2()" .IP "\fImodule_name()\fR" 4 .IX Item "module_name()" .IP "\fImymetafile()\fR" 4 .IX Item "mymetafile()" .IP "\fImymetafile2()\fR" 4 .IX Item "mymetafile2()" .IP "\fIneeds_compiler()\fR" 4 .IX Item "needs_compiler()" .IP "\fIorig_dir()\fR" 4 .IX Item "orig_dir()" .IP "\fIperl()\fR" 4 .IX Item "perl()" .IP "\fIpm_files()\fR" 4 .IX Item "pm_files()" .IP "\fIpod_files()\fR" 4 .IX Item "pod_files()" .IP "\fIpollute()\fR" 4 .IX Item "pollute()" .IP "\fIprefix()\fR" 4 .IX Item "prefix()" .IP "\fIprereq_action_types()\fR" 4 .IX Item "prereq_action_types()" .IP "\fIprogram_name()\fR" 4 .IX Item "program_name()" .IP "\fIpureperl_only()\fR" 4 .IX Item "pureperl_only()" .IP "\fIquiet()\fR" 4 .IX Item "quiet()" .IP "\fIrecommends()\fR" 4 .IX Item "recommends()" .IP "\fIrecurse_into()\fR" 4 .IX Item "recurse_into()" .IP "\fIrecursive_test_files()\fR" 4 .IX Item "recursive_test_files()" .IP "\fIrequires()\fR" 4 .IX Item "requires()" .IP "\fIscripts()\fR" 4 .IX Item "scripts()" .IP "\fIsign()\fR" 4 .IX Item "sign()" .IP "\fItap_harness_args()\fR" 4 .IX Item "tap_harness_args()" .IP "\fItest_file_exts()\fR" 4 .IX Item "test_file_exts()" .IP "\fItest_requires()\fR" 4 .IX Item "test_requires()" .IP "\fIuse_rcfile()\fR" 4 .IX Item "use_rcfile()" .IP "\fIuse_tap_harness()\fR" 4 .IX Item "use_tap_harness()" .IP "\fIverbose()\fR" 4 .IX Item "verbose()" .IP "\fIxs_files()\fR" 4 .IX Item "xs_files()" .PD .SH "MODULE METADATA" .IX Header "MODULE METADATA" If you would like to add other useful metadata, \f(CW\*(C`Module::Build\*(C'\fR supports this with the \f(CW\*(C`meta_add\*(C'\fR and \f(CW\*(C`meta_merge\*(C'\fR arguments to \&\*(L"\fInew()\fR\*(R". The authoritative list of supported metadata can be found at CPAN::Meta::Spec but for convenience \- here are a few of the more useful ones: .IP "keywords" 4 .IX Item "keywords" For describing the distribution using keyword (or \*(L"tags\*(R") in order to make \s-1CPAN\s0.org indexing and search more efficient and useful. .IP "resources" 4 .IX Item "resources" A list of additional resources available for users of the distribution. This can include links to a homepage on the web, a bug tracker, the repository location, and even a subscription page for the distribution mailing list. .SH "AUTHOR" .IX Header "AUTHOR" Ken Williams <kwilliams@cpan.org> .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2001\-2006 Ken Williams. All rights reserved. .PP This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fIperl\fR\|(1), Module::Build(3), Module::Build::Authoring(3), Module::Build::Cookbook(3), ExtUtils::MakeMaker(3) .PP \&\fI\s-1META\s0.yml\fR Specification: CPAN::Meta::Spec