™.. Module::Build::Authoring - Online Linux Manual PageSection : 3pm
Updated : 2009-07-06
Source : perl v5.10.1
Note : Perl Programmers Reference Guide

NAMEModule::Build::Authoring − Authoring Module::Build modules

DESCRIPTIONWhen creating a \*(C`Build.PL\*(C'\fR 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`Build.PL\*(C'\fR script: ​ use Module::Build; ​ Module::Build−>new( ​ module_name => 'Foo::Bar', ​ license => 'perl', ​ )>create_build_script; The model used by \*(C`Module::Build\*(C'\fR is a lot like the \f(CW\*(C`MakeMaker\*(C'\fR 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`Module::Build\*(C'\fR and adding a method called (for example) \*(C`ACTION_test\*(C'\fR, overriding the default 'test' action. You could also add a method called ​\*(C`ACTION_whatever\*(C'\fR, and then you could perform the action \f(CW\*(C`Build whatever\*(C'\fR. For information on providing compatibility with ​\*(C`ExtUtils::MakeMaker\*(C'\fR, see Module::Build::Compat and <http://www.makemaker.org/wiki/index.cgi?ModuleBuildConversionGuide>.

STRUCTUREModule::Build creates a class hierarchy conducive to customization. Here is the parent-child class hierarchy in classy ASCII art: ​ /−−−−−−−−−−−−−−−−−−−−\ ​ | Your::Parent | (If you subclass Module::Build)\−−−−−−−−−−−−−−−−−−−−/ ​ | ​ | ​ /−−−−−−−−−−−−−−−−−−−−\ (Doesn't define any functionality ​ | Module::Build | of its own − just figures out what ​ \−−−−−−−−−−−−−−−−−−−−/ other modules to load.) ​ | ​ | ​ /−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−\ (Some values of $^O may ​ | Module::Build::Platform::$^O | define specialized functionality. ​ \−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−−/ Otherwise it's ...::Default, a ​ | pass−through class.) ​ | ​ /−−−−−−−−−−−−−−−−−−−−−−−−−−\ ​ | Module::Build::Base | (Most of the functionality of ​ \−−−−−−−−−−−−−−−−−−−−−−−−−−/ Module::Build is defined here.)

SUBCLASSINGRight now, there are two ways to subclass Module::Build. The first way is to create a regular module (in a \*(C`.pm\*(C'\fR file) that inherits from Module::Build, and use that module's class instead of using Module::Build directly: ​ −−−−−− in Build.PL: −−−−−−−−−− ​ #!/usr/bin/perl ​ ​ use lib q(/nonstandard/library/path); ​ use My::Builder; # Or whatever you want to call it ​ ​ my $build = My::Builder−>new ​ ( ​ module_name => 'Foo::Bar', # All the regular args... ​ license => 'perl', ​ dist_author => 'A N Other <me@here.net.au>', ​ requires => { Carp => 0 }); ​ $build−>create_build_script; This is relatively straightforward, and is the best way to do things if your My::Builder class contains lots of code. The ​\*(C`create_build_script()\*(C'\fR method will ensure that the current value of ​@INC (including the \*(C`/nonstandard/library/path\*(C'\fR) is propagated to the Build script, so that My::Builder can be found when running build actions. If you find that you need to \*(C`chdir\*(C'\fR into a different directories in your subclass methods or actions, be sure to always return to the original directory (available via the \*(C`base_dir()\*(C'\fR method before returning control to the parent class. This is important to avoid data serialization problems. For very small additions, Module::Build provides a \*(C`subclass()\*(C'\fR method that lets you subclass Module::Build more conveniently, without creating a separate file for your module: ​ −−−−−− in Build.PL: −−−−−−−−−− ​ #!/usr/bin/perl ​ ​ use Module::Build; ​ my $class = Module::Build−>subclass ​ ( ​ class => 'My::Builder', ​ code => q{ ​ sub ACTION_foo { ​ print "I'm fooing to death!\n"; ​ }}, ​ ); ​ ​ my $build = $class−>new ​ ( ​ module_name => 'Foo::Bar', # All the regular args... ​ license => 'perl', ​ dist_author => 'A N Other <me@here.net.au>', ​ requires => { Carp => 0 }); ​ $build−>create_build_script; Behind the scenes, this actually does create a \*(C`.pm\*(C'\fR file, since the code you provide must persist after Build.PL is run if it is to be very useful. See also the documentation for the subclass() in Module::Build::API method.

PREREQUISITES

Types of prerequisitesTo specify what versions of other modules are used by this distribution, several types of prerequisites can be defined with the following parameters: configure_requires Items that must be installed before configuring this distribution (i.e. before running the Build.PL script). This might be a specific minimum version of \*(C`Module::Build\*(C'\fR or any other module the ​Build.PL needs in order to do its stuff. Clients like \*(C`CPAN.pm\*(C'\fR or \*(C`CPANPLUS\*(C'\fR will be expected to pick \f(CW\*(C`configure_requires\*(C'\fR out of the ​META.yml file and install these items before running the ​\*(C`Build.PL\*(C'\fR. If no configure_requires is specified, the current version of Module::Build is automatically added to configure_requires. build_requires Items that are necessary for building and testing this distribution, but aren't necessary after installation. This can help users who only want to install these items temporarily. It also helps reduce the size of the CPAN dependency graph if everything isn't smooshed into ​\*(C`requires\*(C'\fR. requires Items that are necessary for basic functioning. recommends Items that are recommended for enhanced functionality, but there are ways to use this distribution without having them installed. You might also think of this as can use or is aware of or changes behavior in the presence of. conflicts Items that can cause problems with this distribution when installed. This is pretty rare.

Format of prerequisitesThe 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' ​ }, The above four version specifiers have different effects. The value ​'2.4' means that at least version 2.4 of \*(C`Foo::Module\*(C'\fR must be installed. The value 0 means that any version of \*(C`Bar::Module\*(C'\fR is acceptable, even if \*(C`Bar::Module\*(C'\fR doesn't define a version. The more verbose value '>= 1.2, != 1.5, < 2.0' means that ​\*(C`Ken::Module\*(C'\fR's version must be \fBat least\fR 1.2, \fBless than\fR 2.0, and not equal to 1.5. The list of criteria is separated by commas, and all criteria must be satisfied. A special \*(C`perl\*(C'\fR 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.

XS ExtensionsModules which need to compile XS code should list \*(C`ExtUtils::CBuilder\*(C'\fR as a \*(C`build_requires\*(C'\fR element.

SAVING CONFIGURATION INFORMATIONModule::Build provides a very convenient way to save configuration information that your installed modules (or your regression tests) can access. If your Build process calls the \*(C`feature()\*(C'\fR or ​\*(C`config_data()\*(C'\fR methods, then a \f(CW\*(C`Foo::Bar::ConfigData\*(C'\fR module will automatically be created for you, where \*(C`Foo::Bar\*(C'\fR is the ​\*(C`module_name\*(C'\fR parameter as passed to \f(CW\*(C`new()\*(C'\fR. This module provides access to the data saved by these methods, and a way to update the values. There is also a utility script called \*(C`config_data\*(C'\fR distributed with Module::Build that provides a command line interface to this same functionality. See also the generated ​\*(C`Foo::Bar::ConfigData\*(C'\fR documentation, and the \f(CW\*(C`config_data\*(C'\fR script's documentation, for more information.

STARTING MODULE DEVELOPMENTWhen starting development on a new module, it's rarely worth your time to create a tree of all the files by hand. Some automatic module-creators are available: the oldest is \*(C`h2xs\*(C'\fR, which has shipped with perl itself for a long time. Its name reflects the fact that modules were originally conceived of as a way to wrap up a C library (thus the \*(C`h\*(C'\fR part) into perl extensions (thus the \f(CW\*(C`xs\*(C'\fR part). These days, \*(C`h2xs\*(C'\fR has largely been superseded by modules like ​\*(C`ExtUtils::ModuleMaker\*(C'\fR, and \f(CW\*(C`Module::Starter\*(C'\fR. They have varying degrees of support for \*(C`Module::Build\*(C'\fR.

AUTOMATIONOne advantage of Module::Build is that since it's implemented as Perl methods, you can invoke these methods directly if you want to install a module non-interactively. For instance, the following Perl script will invoke the entire build/install procedure: ​ my $build = Module::Build−>new(module_name => 'MyModule'); ​ $build−>dispatch('build'); ​ $build−>dispatch('test'); ​ $build−>dispatch('install'); If any of these steps encounters an error, it will throw a fatal exception. You can also pass arguments as part of the build process: ​ my $build = Module::Build−>new(module_name => 'MyModule'); ​ $build−>dispatch('build'); ​ $build−>dispatch('test', verbose => 1); ​ $build−>dispatch('install', sitelib => '/my/secret/place/'); Building and installing modules in this way skips creating the ​\*(C`Build\*(C'\fR script.

MIGRATIONNote that if you want to provide both a Makefile.PL and a ​Build.PL for your distribution, you probably want to add the following to \*(C`WriteMakefile\*(C'\fR in your \fIMakefile.PL\fR so that \f(CW\*(C`MakeMaker\*(C'\fR doesn't try to run your Build.PL as a normal .PL file: ​ PL_FILES => {}, You may also be interested in looking at the \*(C`Module::Build::Compat\*(C'\fR module, which can automatically create various kinds of Makefile.PL compatibility layers.

AUTHORKen Williams <kwilliams@cpan.org> Development questions, bug reports, and patches should be sent to the Module-Build mailing list at <module−build@perl.org>. Bug reports are also welcome at <http://rt.cpan.org/NoAuth/Bugs.html?Dist=Module−Build>. The latest development version is available from the Subversion repository at <https://svn.perl.org/modules/Module−Build/trunk/>

SEE ALSOperl(1), Module::Build(3), Module::Build::API(3), Module::Build::Cookbook(3), ExtUtils::MakeMaker(3), YAML(3) META.yml Specification: <http://module−build.sourceforge.net/META−spec−current.html> <http://www.dsmit.com/cons/> <http://search.cpan.org/dist/PerlBuildSystem/>
0
Johanes Gumabo
Data Size   :   37,738 byte
man-Module::Build::Authoring.3pmBuild   :   2024-12-29, 07:25   :  
Visitor Screen   :   x
Visitor Counter ( page / site )   :   3 / 255,996
Visitor ID   :     :  
Visitor IP   :   3.146.107.152   :  
Visitor Provider   :   AMAZON-02   :  
Provider Position ( lat x lon )   :   39.962500 x -83.006100   :   x
Provider Accuracy Radius ( km )   :   1000   :  
Provider City   :   Columbus   :  
Provider Province   :   Ohio ,   :   ,
Provider Country   :   United States   :  
Provider Continent   :   North America   :  
Visitor Recorder   :   Version   :  
Visitor Recorder   :   Library   :  
Online Linux Manual Page   :   Version   :   Online Linux Manual Page - Fedora.40 - march=x86-64 - mtune=generic - 24.12.29
Online Linux Manual Page   :   Library   :   lib_c - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Online Linux Manual Page   :   Library   :   lib_m - 24.10.03 - march=x86-64 - mtune=generic - Fedora.40
Data Base   :   Version   :   Online Linux Manual Page Database - 24.04.13 - march=x86-64 - mtune=generic - fedora-38
Data Base   :   Library   :   lib_c - 23.02.07 - march=x86-64 - mtune=generic - fedora.36

Very long time ago, I have the best tutor, Wenzel Svojanovsky . If someone knows the email address of Wenzel Svojanovsky , please send an email to johanes_gumabo@yahoo.co.id .
If error, please print screen and send to johanes_gumabo@yahoo.co.id
Under development. Support me via PayPal.

ERROR : Need New Coding :         (parse_manual_page_|252|Module::Build::Authoring.3pm|36/37|el══─{─══.|.el══─{─══. ds -- \|\(em\| )         (htmlprn|149|Module::Build::Authoring.3pm|36/37|.el══─{─══. ds --  —  |.el══─{─══. ds -- \|\(em\| )         (parse_manual_page_|252|Module::Build::Authoring.3pm|41|br══─}─══|'br══─}─══ )         (htmlprn|149|Module::Build::Authoring.3pm|41|'br══─}─══ |'br══─}─══ )         (rof_nr_x|149|Module::Build::Authoring.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (rof_unit_scale_px|41|Module::Build::Authoring.3pm|51/52|F|.ie \nF ══─{─══. de IX )         (rof_if|19|Module::Build::Authoring.3pm|51/52|\nF|.ie \nF ══─{─══. de IX )         (htmlprn|149|Module::Build::Authoring.3pm|51/52|.ie \nF ══─{─══. de IX|.ie \nF ══─{─══. de IX )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|53|\$1\t\\n%\t"\\$2" |. tm Index:\\$1\t\\n%\t"\\$2" )         (parse_manual_page_|252|Module::Build::Authoring.3pm|57|══─}─══|.══─}─══ )         (htmlprn|149|Module::Build::Authoring.3pm|57|.══─}─══ |.══─}─══ )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|136|\*(C`Build.PL\*(C'\fR script for a module, something like the |When creating a \f(CW\*(C`Build.PL\*(C'\fR script for a module, something like the )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|155|\*(C`Build.PL\*(C'\fR script: |\&\f(CW\*(C`Build.PL\*(C'\fR script: )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|165|\*(C`Module::Build\*(C'\fR is a lot like the \f(CW\*(C`MakeMaker\*(C'\fR |The model used by \f(CW\*(C`Module::Build\*(C'\fR is a lot like the \f(CW\*(C`MakeMaker\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|176|\*(C`Module::Build\*(C'\fR |Any customization can be done simply by subclassing \f(CW\*(C`Module::Build\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|177|\*(C`ACTION_test\*(C'\fR, overriding |and adding a method called (for example) \f(CW\*(C`ACTION_test\*(C'\fR, overriding )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|179|\*(C`ACTION_whatever\*(C'\fR, and then you could perform the action \f(CW\*(C`Build |\&\f(CW\*(C`ACTION_whatever\*(C'\fR, and then you could perform the action \f(CW\*(C`Build )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|180|\*(C'\fR. |whatever\*(C'\fR. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|183|\*(C`ExtUtils::MakeMaker\*(C'\fR, see Module::Build::Compat and |\&\f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR, see Module::Build::Compat and )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|213|\*(C`.pm\*(C'\fR file) that inherits |way is to create a regular module (in a \f(CW\*(C`.pm\*(C'\fR file) that inherits )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|236|\*(C`create_build_script()\*(C'\fR method will ensure that the current value of |\&\f(CW\*(C`create_build_script()\*(C'\fR method will ensure that the current value of )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|237|\*(C`/nonstandard/library/path\*(C'\fR) is propagated to |\&\f(CW@INC\fR (including the \f(CW\*(C`/nonstandard/library/path\*(C'\fR) is propagated to )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|239|\*(C`chdir\*(C'\fR into a different directories |actions. If you find that you need to \f(CW\*(C`chdir\*(C'\fR into a different directories )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|241|\*(C`base_dir()\*(C'\fR method before returning control |directory (available via the \f(CW\*(C`base_dir()\*(C'\fR method before returning control )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|244|\*(C`subclass()\*(C'\fR |For very small additions, Module::Build provides a \f(CW\*(C`subclass()\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|273|\*(C`.pm\*(C'\fR file, since the |Behind the scenes, this actually does create a \f(CW\*(C`.pm\*(C'\fR file, since the )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|290|\*(C`Module::Build\*(C'\fR or any other module the |specific minimum version of \f(CW\*(C`Module::Build\*(C'\fR or any other module the )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|291|\*(C`CPAN.pm\*(C'\fR |\&\fIBuild.PL\fR needs in order to do its stuff. Clients like \f(CW\*(C`CPAN.pm\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|292|\*(C`CPANPLUS\*(C'\fR will be expected to pick \f(CW\*(C`configure_requires\*(C'\fR out of the |or \f(CW\*(C`CPANPLUS\*(C'\fR will be expected to pick \f(CW\*(C`configure_requires\*(C'\fR out of the )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|294|\*(C`Build.PL\*(C'\fR. |\&\f(CW\*(C`Build.PL\*(C'\fR. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|304|\*(C`requires\*(C'\fR. |\&\f(CW\*(C`requires\*(C'\fR. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|333|\*(C`Foo::Module\*(C'\fR must be |\&\f(CW\*(Aq2.4\*(Aq\fR means that \fBat least\fR version 2.4 of \f(CW\*(C`Foo::Module\*(C'\fR must be )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|334|\*(C`Bar::Module\*(C'\fR |installed. The value \f(CW0\fR means that \fBany\fR version of \f(CW\*(C`Bar::Module\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|335|\*(C`Bar::Module\*(C'\fR doesn't define a version. The |is acceptable, even if \f(CW\*(C`Bar::Module\*(C'\fR doesn't define a version. The )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|337|\*(C`Ken::Module\*(C'\fR's version must be \fBat least\fR 1.2, \fBless than\fR 2.0, |\&\f(CW\*(C`Ken::Module\*(C'\fR's version must be \fBat least\fR 1.2, \fBless than\fR 2.0, )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|341|\*(C`perl\*(C'\fR entry lets you specify the versions of the Perl |A special \f(CW\*(C`perl\*(C'\fR entry lets you specify the versions of the Perl )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|347|\*(C`ExtUtils::CBuilder\*(C'\fR |Modules which need to compile \s-1XS\s0 code should list \f(CW\*(C`ExtUtils::CBuilder\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|348|\*(C`build_requires\*(C'\fR element. |as a \f(CW\*(C`build_requires\*(C'\fR element. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|353|\*(C`feature()\*(C'\fR or |access. If your Build process calls the \f(CW\*(C`feature()\*(C'\fR or )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|354|\*(C`config_data()\*(C'\fR methods, then a \f(CW\*(C`Foo::Bar::ConfigData\*(C'\fR module will |\&\f(CW\*(C`config_data()\*(C'\fR methods, then a \f(CW\*(C`Foo::Bar::ConfigData\*(C'\fR module will )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|355|\*(C`Foo::Bar\*(C'\fR is the |automatically be created for you, where \f(CW\*(C`Foo::Bar\*(C'\fR is the )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|356|\*(C`module_name\*(C'\fR parameter as passed to \f(CW\*(C`new()\*(C'\fR. This module provides |\&\f(CW\*(C`module_name\*(C'\fR parameter as passed to \f(CW\*(C`new()\*(C'\fR. This module provides )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|358|\*(C`config_data\*(C'\fR |values. There is also a utility script called \f(CW\*(C`config_data\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|361|\*(C`Foo::Bar::ConfigData\*(C'\fR documentation, and the \f(CW\*(C`config_data\*(C'\fR |\&\f(CW\*(C`Foo::Bar::ConfigData\*(C'\fR documentation, and the \f(CW\*(C`config_data\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|367|\*(C`h2xs\*(C'\fR, which has |module-creators are available: the oldest is \f(CW\*(C`h2xs\*(C'\fR, which has )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|370|\*(C`h\*(C'\fR part) into perl extensions (thus the \f(CW\*(C`xs\*(C'\fR |library (thus the \f(CW\*(C`h\*(C'\fR part) into perl extensions (thus the \f(CW\*(C`xs\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|373|\*(C`h2xs\*(C'\fR has largely been superseded by modules like |These days, \f(CW\*(C`h2xs\*(C'\fR has largely been superseded by modules like )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|374|\*(C`ExtUtils::ModuleMaker\*(C'\fR, and \f(CW\*(C`Module::Starter\*(C'\fR. They have varying |\&\f(CW\*(C`ExtUtils::ModuleMaker\*(C'\fR, and \f(CW\*(C`Module::Starter\*(C'\fR. They have varying )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|375|\*(C`Module::Build\*(C'\fR. |degrees of support for \f(CW\*(C`Module::Build\*(C'\fR. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|403|\*(C`Build\*(C'\fR script. |\&\f(CW\*(C`Build\*(C'\fR script. )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|408|\*(C`WriteMakefile\*(C'\fR in your \fIMakefile.PL\fR so that \f(CW\*(C`MakeMaker\*(C'\fR |following to \f(CW\*(C`WriteMakefile\*(C'\fR in your \fIMakefile.PL\fR so that \f(CW\*(C`MakeMaker\*(C'\fR )         (rof_escape_sequence|91|Module::Build::Authoring.3pm|415|\*(C`Module::Build::Compat\*(C'\fR |You may also be interested in looking at the \f(CW\*(C`Module::Build::Compat\*(C'\fR )