.\" Automatically generated by Pod::Man 4.14 (Pod::Simple 3.43) .\" .\" 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 >0, 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 .\" ======================================================================== .\" .IX Title "ExtUtils::ModuleMaker 3pm" .TH ExtUtils::ModuleMaker 3pm "2023-01-27" "perl v5.36.0" "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" ExtUtils::ModuleMaker \- Better than h2xs for creating modules .SH "SYNOPSIS" .IX Header "SYNOPSIS" At the command prompt: .PP .Vb 1 \& % modulemaker .Ve .PP Inside a Perl program: .PP .Vb 1 \& use ExtUtils::ModuleMaker; \& \& $mod = ExtUtils::ModuleMaker\->new( \& NAME => \*(AqSample::Module\*(Aq \& ); \& \& $mod\->complete_build(); \& \& $mod\->dump_keys(qw| \& ... # key provided as argument to constructor \& ... # same \& |); \& \& $mod\->dump_keys_except(qw| \& ... # key provided as argument to constructor \& ... # same \& |); \& \& $license = $mod\->get_license(); \& \& $mod\->make_selections_defaults(); .Ve .SH "VERSION" .IX Header "VERSION" This document references version 0.63 of ExtUtils::ModuleMaker, released to \s-1CPAN\s0 on July 31 2018. .SH "DESCRIPTION" .IX Header "DESCRIPTION" This module is a replacement for the most typical use of the \fIh2xs\fR utility bundled with all Perl distributions: the creation of the directories and files required for a pure-Perl module to be installable with \&\fImake\fR and distributable on the Comprehensive Perl Archive Network (\s-1CPAN\s0). .PP \&\fIh2xs\fR has many options which are useful \*(-- indeed, necessary \*(-- for the creation of a properly structured distribution that includes C code as well as Perl code. Most of the time, however, \fIh2xs\fR is used as follows .PP .Vb 1 \& % h2xs \-AXn My::Module .Ve .PP to create a distribution containing only Perl code. ExtUtils::ModuleMaker is intended to be an easy-to-use replacement for \fIthis\fR use of \fIh2xs\fR. .PP While you can call ExtUtils::ModuleMaker from within a Perl script (as in the \s-1SYNOPSIS\s0 above), it's easier to use with a command-prompt invocation of the \fImodulemaker\fR script bundled with this distribution: .PP .Vb 1 \& % modulemaker .Ve .PP Then respond to the prompts. For Perl programmers, laziness is a virtue \*(-- and \fImodulemaker\fR is far and away the laziest way to create a pure Perl distribution which meets all the requirements for worldwide distribution via \s-1CPAN.\s0 .SH "USAGE" .IX Header "USAGE" .SS "Usage from the command-line with \fImodulemaker\fP" .IX Subsection "Usage from the command-line with modulemaker" The easiest way to use ExtUtils::ModuleMaker is to invoke the \&\fImodulemaker\fR script from the command-line. You can control the content of the files built by \fImodulemaker\fR either by supplying command-line options or \&\*(-- easier still \*(-- replying to the screen prompts in \fImodulemaker\fR's interactive mode. .PP \&\fBIf you are encountering ExtUtils::ModuleMaker for the first time, you should turn now to the documentation for \f(BImodulemaker\fB which is bundled this distribution.\fR Return to this document once you have become familiar with \&\fImodulemaker\fR. .SS "Use of Public Methods within a Perl Program" .IX Subsection "Use of Public Methods within a Perl Program" You can use ExtUtils::ModuleMaker within a Perl script to generate the directories and files needed to begin work on a CPAN-ready Perl distribution. You will need to call \f(CW\*(C`new()\*(C'\fR and \f(CW\*(C`complete_build()\*(C'\fR, both of which are described in the next section. These two methods control the building of the file and directory structure for a new Perl distribution. .PP There are four other publicly available methods in this version of ExtUtils::ModuleMaker. \f(CW\*(C`dump_keys\*(C'\fR, \f(CW\*(C`dump_keys_except\*(C'\fR and \f(CW\*(C`get_license\*(C'\fR are intended primarily as shortcuts for trouble-shooting problems with an ExtUtils::ModuleMaker object. \f(CW\*(C`make_selections_defaults\*(C'\fR enables you to be even lazier in your use of ExtUtils::ModuleMaker by saving keystrokes entered for attributes. .PP \fI\f(CI\*(C`new\*(C'\fI\fR .IX Subsection "new" .PP Creates and returns an ExtUtils::ModuleMaker object. Takes a list containing key-value pairs with information specifying the structure and content of the new module(s). (In this documentation, we will sometimes refer to these key-value pairs as the \fIattributes\fR of the ExtUtils::ModuleMaker object.) With the exception of key \f(CW\*(C`EXTRA_MODULES\*(C'\fR (see below), the values in these pairs are all strings. Like most such lists of key-value pairs, this list is probably best held in a hash. Keys which may be specified are: .IP "\(bu" 4 Required Argument .RS 4 .IP "\(bu" 4 \&\s-1NAME\s0 .Sp The \fBonly\fR required feature. This is the name of the primary module (with '\f(CW\*(C`::\*(C'\fR' separators if needed). Will no longer support the older, Perl 4\-style separator "\f(CW\*(C`\*(Aq\*(C'\fR" like the module \fID'Oh\fR. There is no current default for \s-1NAME\s0; you must supply a name explicitly. .RE .RS 4 .RE .IP "\(bu" 4 Other Important Arguments .RS 4 .IP "\(bu" 4 \&\s-1ABSTRACT\s0 .Sp A short description of the module. \s-1CPAN\s0 likes to use this feature to describe the module. If the abstract contains an apostrophe (\f(CW\*(C`\*(Aq\*(C'\fR), then the value corresponding to key \f(CW\*(C`ABSTRACT\*(C'\fR in the list passed to the constructor must be double-quoted; otherwise \fIMakefile.PL\fR gets messed up. Certain \s-1CPAN\s0 indexing features still work better if the abstract is 44 or fewer characters in length, but this does not appear to be as mandatory as in the past. (Defaults to dummy copy.) .IP "\(bu" 4 \&\s-1VERSION\s0 .Sp A string holding the version number. For alpha releases, include an underscore to the right of the dot like \f(CW\*(C`0.31_21\*(C'\fR. (Default is \f(CW0.01\fR.) .IP "\(bu" 4 \&\s-1LICENSE\s0 .Sp Which license to include in the Copyright section. You can choose one of the standard licenses by including 'perl', 'gpl', 'artistic', and 18 others approved by opensource.org. The default is to choose the 'perl' flavor which is to share it \*(L"under the same terms as Perl itself.\*(R" .Sp Other licenses can be added by individual module authors to ExtUtils::ModuleMaker::Licenses::Local to keep your company lawyers happy. .Sp Some licenses include placeholders that will be replaced with \s-1AUTHOR\s0 information. .IP "\(bu" 4 \&\s-1BUILD_SYSTEM\s0 .Sp This can take one of three values: .RS 4 .IP "\(bu" 4 \&\f(CW\*(AqExtUtils::MakeMaker\*(Aq\fR .Sp The first generates a basic Makefile.PL file for your module. .IP "\(bu" 4 \&\f(CW\*(AqModule::Build\*(Aq\fR .Sp The second creates a Build.PL file. .IP "\(bu" 4 \&\f(CW\*(AqModule::Build and Proxy\*(Aq\fR .Sp The third creates a Build.PL along with a proxy Makefile.PL script that attempts to install Module::Build if necessary, and then runs the Build.PL script. This option is recommended if you want to use Module::Build as your build system. See Module::Build::Compat for more details. .Sp \&\fBNote:\fR To correct a discrepancy between the documentation and code in earlier versions of ExtUtils::ModuleMaker, we now explicitly provide this synonym for the third option: .Sp .Vb 1 \& \*(AqModule::Build and proxy Makefile.PL\*(Aq .Ve .Sp (Thanks to David A Golden for spotting this bug.) .RE .RS 4 .RE .IP "\(bu" 4 \&\s-1COMPACT\s0 .Sp For a module named \*(L"Foo::Bar::Baz\*(R" creates a base directory named \&\*(L"Foo-Bar-Baz\*(R" instead of Foo/Bar/Baz. (Default is off.) .IP "\(bu" 4 \&\s-1VERBOSE\s0 .Sp Prints messages to \s-1STDOUT\s0 as it creates directories, writes files, etc. (Default is off.) .IP "\(bu" 4 \&\s-1PERMISSIONS\s0 .Sp Used to create new directories. (Default is 0755: group and world can not write.) .IP "\(bu" 4 \&\s-1USAGE_MESSAGE\s0 .Sp Message given when the module \f(CW\*(C`die\*(C'\fRs. Scripts should set this to the same string it would print if the user asked for help. (A reasonable default is provided.) .IP "\(bu" 4 \&\s-1NEED_POD\s0 .Sp Include \s-1POD\s0 section in \fI*.pm\fR files created. (Default is on.) .IP "\(bu" 4 \&\s-1NEED_NEW_METHOD\s0 .Sp Include a simple \f(CW\*(C`new()\*(C'\fR method in the \fI*.pm\fR files created. (Default is on.) .IP "\(bu" 4 \&\s-1CHANGES_IN_POD\s0 .Sp Omit a \fIChanges\fR file, but instead add a \s-1HISTORY\s0 section to the \s-1POD.\s0 (Default is off). .IP "\(bu" 4 \&\s-1INCLUDE_MANIFEST_SKIP\s0 .Sp Boolean value which, if true, includes a \fI\s-1MANIFEST.SKIP\s0\fR file in the distribution with reasonable default values facilitating use of the \fImake manifest\fR command during module development. (Thanks to David A Golden for this feature. Default is off.) .IP "\(bu" 4 \&\s-1INCLUDE_TODO\s0 .Sp Boolean value which, if true, includes a \fITodo\fR file in the distribution in which the module's author or maintainer can discuss future lines of development. (Default is on.) .IP "\(bu" 4 \&\s-1INCLUDE_LICENSE\s0 .Sp Boolean value which, if true, includes a \fI\s-1LICENSE\s0\fR file in the distribution. (Which \s-1LICENSE\s0 file is determined in the \s-1LICENSE\s0 option.) (Default is on.) .IP "\(bu" 4 \&\s-1INCLUDE_SCRIPTS_DIRECTORY\s0 .Sp Boolean value which, if true, includes a \fIscripts/\fR directory (at the same level as \fIlib/\fR or \fIt/\fR). (Default is on.) .IP "\(bu" 4 \&\s-1INCLUDE_WARNINGS\s0 .Sp Boolean value which, if true, inserts \f(CW\*(C`use warnings;\*(C'\fR in all Perl modules created by use of this module. (Default is off.) .IP "\(bu" 4 \&\s-1INCLUDE_ID_LINE\s0 .Sp Boolean value which, if true, inserts \f(CW\*(C`#$Id$\*(C'\fR in all Perl modules created by use of this module for the purpose of inserting a Subversion file \&'Id' string. (Default is off.) .RE .RS 4 .RE .IP "\(bu" 4 Arguments Related to the Module's Author .RS 4 .IP "\(bu" 4 \&\s-1AUTHOR\s0 .Sp Name of the author. If the author's name contains an apostrophe (\f(CW\*(C`\*(Aq\*(C'\fR), then the corresponding value in the list passed to the constructor must be double-quoted; otherwise \fIMakefile.PL\fR gets messed up. (Defaults to dummy copy.) .IP "\(bu" 4 \&\s-1EMAIL\s0 .Sp Email address of the author. If the author's e\-mail address contains an apostrophe (\f(CW\*(C`\*(Aq\*(C'\fR), then the corresponding value in the list passed to the constructor must be double-quoted; otherwise \&\fIMakefile.PL\fR gets messed up. (Defaults to dummy copy.) .IP "\(bu" 4 \&\s-1CPANID\s0 .Sp The \s-1CPANID\s0 of the author. (Defaults to dummy copy. To suppress printing of this line entirely, set \f(CW\*(C`CPANID\*(C'\fR to a Perl-false value such as an empty string.) .IP "\(bu" 4 \&\s-1WEBSITE\s0 .Sp The personal or organizational website of the author. (Defaults to dummy copy. To suppress printing of this line entirely, set \f(CW\*(C`CPANID\*(C'\fR to a Perl-false value such as an empty string.) .IP "\(bu" 4 \&\s-1ORGANIZATION\s0 .Sp Company or group owning the module. (Defaults to dummy copy. To suppress printing of this line entirely, set \f(CW\*(C`CPANID\*(C'\fR to a Perl-false value such as an empty string.) .RE .RS 4 .RE .IP "\(bu" 4 Argument Related to Multiple Modules within a Distribution .RS 4 .IP "\(bu" 4 \&\s-1EXTRA_MODULES\s0 .Sp A reference to an array of hashes, each of which contains values for additional modules in the distribution. .Sp .Vb 8 \& $mod = ExtUtils::ModuleMaker\->new( \& NAME => \*(AqAlpha::Beta\*(Aq, \& EXTRA_MODULES => [ \& { NAME => \*(AqAlpha::Beta::Gamma\*(Aq }, \& { NAME => \*(AqAlpha::Beta::Delta\*(Aq }, \& { NAME => \*(AqAlpha::Beta::Gamma::Epsilon\*(Aq }, \& ], \& ); .Ve .Sp As with the primary module, the only attribute required for each extra module is \f(CW\*(C`NAME\*(C'\fR. Other attributes may be supplied but the primary module's values will be used if no value is given here. .Sp Each extra module will be created in the correct relative place in the \&\fIlib\fR directory. By default, a test file will also be created in the \fIt\fR directory corresponding to each extra module to test that it loads properly. (See \s-1EXTRA_MODULES_SINGLE_TEST_FILE\s0 below to learn how to change this behavior.) However, no other supporting documents (\fIe.g.,\fR \s-1README,\s0 Changes) will be created. .Sp This is one major improvement over the earlier \fIh2xs\fR as you can now build multi-module packages. .RE .RS 4 .RE .IP "\(bu" 4 Arguments Related to Test Files .RS 4 .IP "\(bu" 4 \&\s-1FIRST_TEST_NUMBER\s0 .Sp A non-negative natural number from which the count begins in test files that are numerically ordered. (Default is \f(CW1\fR.) .IP "\(bu" 4 \&\s-1TEST_NUMBER_FORMAT\s0 .Sp In test files that are numerically ordered, a Perl \f(CW\*(C`sprintf\*(C'\fR formatting string that specifies how \s-1FIRST_TEST_NUMBER\s0 is to be formatted. (Default is \&\f(CW"%03d"\fR.) .IP "\(bu" 4 \&\s-1TEST_NAME\s0 .Sp String forming the core of the name of a test file. (Default is \f(CW\*(C`load\*(C'\fR). .IP "\(bu" 4 \&\s-1TEST_NAME_DERIVED_FROM_MODULE_NAME\s0 .Sp Boolean value which, when true, tells ExtUtils::ModuleMaker to create a file in the test suite with a name derived from the \fI.pm\fR package it is testing, thereby overriding any value set in the \s-1TEST_NAME\s0 attribute. For example, for a module called 'Alpha::Sigma::Tau', a test file named \fIt/Alpha_Sigma_Tau.t\fR will be created. (Default is off.) .IP "\(bu" 4 \&\s-1TEST_NAME_SEPARATOR\s0 .Sp String holding the character which joins components of a test file's name, \&\fIe.g.,\fR the character used to join \f(CW001\fR and in a file named \&\fI001_load.t\fR. (Defaults to an underscore \f(CW\*(C`_\*(C'\fR.) .IP "\(bu" 4 \&\s-1EXTRA_MODULES_SINGLE_TEST_FILE\s0 .Sp Boolean value which, when true and when extra modules have been specified in the \s-1EXTRA_MODULES\s0 attribute, will put tests for those extra modules in a single test file rather than in individual test files corresponding to each module. (Default is off.) .IP "\(bu" 4 \&\s-1INCLUDE_POD_COVERAGE_TEST\s0 .Sp Boolean value which, if true, causes a test file called \fIt/pod\-coverage.t\fR to be included in the \fIt/\fR directory. This test is advocated by some Perl quality assurance experts and module authors. However, since the maintainer of ExtUtils::ModuleMaker is not persuaded of its worth, default is off. .IP "\(bu" 4 \&\s-1INCLUDE_POD_TEST\s0 .Sp Boolean value which, if true, causes a test file called \fIt/pod.t\fR to be included in the \fIt/\fR directory. This test is advocated by some Perl quality assurance experts and module authors. However, since the maintainer of ExtUtils::ModuleMaker is not persuaded of its worth, default is off. .IP "\(bu" 4 \&\s-1INCLUDE_FILE_IN_PM\s0 .Sp String holding a path to a file containing Perl code and/or documentation which will be included in each \fIlib/*.pm\fR file created in a particular distribution. By default, such content is placed after any constructor and before the main \s-1POD\s0 block. This could, for example, be used to insert stub subroutines in each package within a distribution. Default is off. .RE .RS 4 .RE .IP "\(bu" 4 Arguments for Advanced Usages .RS 4 .IP "\(bu" 4 \&\s-1INTERACTIVE\s0 .Sp Activates interactive mode in \fImodulemaker\fR utility. The interactive mode presents the user with a series of menus from which the user selects features by entering text at the command prompt. This attribute should only be used by interactive scripts like \fImodulemaker\fR. (Default is off.) .IP "\(bu" 4 \&\s-1ALT_BUILD\s0 .Sp Name of a Perl package holding methods which override those called withiin \&\f(CW\*(C`complete_build\*(C'\fR to shape the content of files created by using ExtUtils::ModuleMaker. See \*(L"An Alternative Approach to Subclassing\*(R" below. .RE .RS 4 .RE .PP \fI\f(CI\*(C`complete_build\*(C'\fI\fR .IX Subsection "complete_build" .PP Creates all directories and files as configured by the key-value pairs passed to \f(CW\*(C`ExtUtils::ModuleMaker::new\*(C'\fR. Returns a true value if all specified files are created \*(-- but this says nothing about whether those files have been created with the correct content. .PP \fI\f(CI\*(C`dump_keys\*(C'\fI\fR .IX Subsection "dump_keys" .PP When troubleshooting problems with an ExtUtils::ModuleMaker object, it is often useful to use \fIData::Dumper\fR to dump the contents of the object. Use \f(CW\*(C`dump_keys()\*(C'\fR when you only need to examine a few of the object's attributes. .PP .Vb 1 \& $mod\->dump_keys( qw| NAME ABSTRACT | ); .Ve .PP \fI\f(CI\*(C`dump_keys_except\*(C'\fI\fR .IX Subsection "dump_keys_except" .PP When troubleshooting problems with an ExtUtils::ModuleMaker object, it is often useful to use \fIData::Dumper\fR to dump the contents of the object. However, since certain elements of that object are often quite lengthy (\fIe.g,\fR the values of keys \f(CW\*(C`LicenseParts\*(C'\fR and \&\f(CW\*(C`USAGE_MESSAGE\*(C'\fR), it's handy to have a dumper function that dumps all keys \fIexcept\fR certain designated keys. .PP .Vb 1 \& $mod\->dump_keys_except(qw| LicenseParts USAGE_MESSAGE |); .Ve .PP \fI\f(CI\*(C`get_license\*(C'\fI\fR .IX Subsection "get_license" .PP Returns a string which nicely formats a short version of the License and Copyright information. .PP .Vb 2 \& $license = $mod\->get_license(); \& print $license; .Ve .PP \&... will print something like this: .PP .Vb 8 \& ===================================================================== \& ===================================================================== \& [License Information] \& ===================================================================== \& ===================================================================== \& [Copyright Information] \& ===================================================================== \& ===================================================================== .Ve .PP (Earlier versions of ExtUtils::ModuleMaker contained a \&\f(CW\*(C`Display_License\*(C'\fR function in each of submodules \&\fIExtUtils::ModuleMaker::Licenses::Standard\fR and \&\fIExtUtils::ModuleMaker::Licenses::Local\fR. These functions were never publicly documented or tested. \f(CW\*(C`get_license()\*(C'\fR is intended as a replacement for those two functions.) .PP \fI\f(CI\*(C`make_selections_defaults()\*(C'\fI\fR .IX Subsection "make_selections_defaults()" .PP Saves the values you entered as arguments passed to \f(CW\*(C`new()\*(C'\fR in a personal defaults file so that they supersede the defaults provided by ExtUtils::ModuleMaker itself. .PP This is an advanced usage of ExtUtils::ModuleMaker. If you have used ExtUtils::ModuleMaker more than once, you have probably typed in a choice for \f(CW\*(C`AUTHOR\*(C'\fR, \f(CW\*(C`EMAIL\*(C'\fR, etc., more than once. To save unnecessary typing and reduce typing errors, ExtUtils::ModuleMaker now offers you the possibility of establishing \fBpersonal default values\fR which override the default values supplied with the distribution and found in \&\fIlib/ExtUtils/ModuleMaker/Defaults.pm\fR. .PP Suppose that you have called \f(CW\*(C`ExtUtils::ModuleMaker::new()\*(C'\fR as follows: .PP .Vb 9 \& $mod = ExtUtils::ModuleMaker\->new( \& NAME => \*(AqSample::Module\*(Aq, \& ABSTRACT => \*(AqNow is the time to join the party\*(Aq, \& AUTHOR => \*(AqHilton Stallone\*(Aq, \& CPANID => \*(AqRAMBO\*(Aq, \& ORGANIZATION => \*(AqParliamentary Pictures\*(Aq, \& WEBSITE => \*(Aqhttp://parliamentarypictures.com\*(Aq, \& EMAIL => \*(Aqhiltons@parliamentarypictures.com\*(Aq, \& ); .Ve .PP While \f(CW$mod\fR is still in scope, you can call: .PP .Vb 1 \& $mod\->make_selections_defaults() .Ve .PP and the values selected \*(-- \fBwith two important exceptions\fR \&\*(-- will be saved in a \fIPersonal/Defaults.pm\fR file stored in your home directory. The next time you invoke ExtUtils::ModuleMaker, the new values will appear in the appropriate locations in the files created by \f(CW\*(C`complete_build()\*(C'\fR. They will also appear in the menus provided on screen by the \fImodulemaker\fR utility. .PP What are those two important exceptions? .IP "\(bu" 4 \&\f(CW\*(C`NAME\*(C'\fR .Sp You cannot enter a default value for \f(CW\*(C`NAME\*(C'\fR: the name of the module you are creating. ExtUtil::ModuleMaker's own defaults file omits a value for \&\f(CW\*(C`NAME\*(C'\fR to prevent you from overwriting an already existing module. (More precisely, the default value is an empty string. ExtUtil::ModuleMaker will throw an error if you attempt to create a module whose name is empty.) This precaution applies to your personal defaults file as well. .IP "\(bu" 4 \&\f(CW\*(C`ABSTRACT\*(C'\fR .Sp Since every module you create presumably has its own unique purpose, every module must have a unique \f(CW\*(C`ABSTRACT\*(C'\fR to summarize that purpose. ExtUtil::ModuleMaker supplies the following string as the default value for the \f(CW\*(C`ABSTRACT\*(C'\fR key: .Sp .Vb 1 \& Module abstract (<= 44 characters) goes here .Ve .Sp \&... a string which, not coincidentally, happens to be exactly 44 characters long \*(-- so you can just overstrike it. This will be the default value for \&\f(CW\*(C`ABSTRACT\*(C'\fR in any \fIPersonal/Defaults.pm\fR file you create as well. .SH "CUSTOMIZATION" .IX Header "CUSTOMIZATION" ExtUtils::ModuleMaker is designed to be customizable to your needs and to offer you more flexibility as you become more experienced with it. .SS "Via \fImodulemaker\fP Utility Interactive Mode" .IX Subsection "Via modulemaker Utility Interactive Mode" As with everything else about ExtUtils::ModuleMaker, the easiest, laziest way to get started is via the \fImodulemaker\fR utility; see its documentation. Suppose that you have entered your correct name, email address and website at the prompts in \fImodulemaker\fR's Author Menu. .PP .Vb 1 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \& modulemaker: Author Menu \& \& Feature Current Value \& N \- Author \*(AqJohn Q Public\*(Aq \& C \- CPAN ID \*(AqMODAUTHOR\*(Aq \& O \- Organization \*(AqXYZ Corp.\*(Aq \& W \- Website \*(Aqhttp://public.net/~jqpublic\*(Aq \& E \- Email \*(Aqjqpublic@public.net\*(Aq \& \& R \- Return to main menu \& X \- Exit immediately \& \& Please choose which feature you would like to edit: .Ve .PP Why should you ever have to enter this information again? Return to the \fImodulemaker\fR Main Menu (\f(CW\*(C`R\*(C'\fR). .PP .Vb 1 \& \-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\-\- \& \& modulemaker: Main Menu \& \& Feature Current Value \& N \- Name of module \*(Aq\*(Aq \& S \- Abstract \*(AqModule abstract (<= 44 characters) goes here\*(Aq \& A \- Author information \& L \- License \*(Aqperl\*(Aq \& D \- Directives \& B \- Build system \*(AqExtUtils::MakeMaker\*(Aq \& \& G \- Generate module \& H \- Generate module; \& save selections as defaults \& \& X \- Exit immediately \& \& Please choose which feature you would like to edit: .Ve .PP Select \f(CW\*(C`H\*(C'\fR instead of \f(CW\*(C`G\*(C'\fR to generate the distribution. An internal call to \f(CW\*(C`make_selections_defaults()\*(C'\fR will save those selections in a personal defaults file and present them to you on the Author Menu the next time you go to use it. .SS "Via \fImodulemaker\fP Utility Command-Line Options Mode" .IX Subsection "Via modulemaker Utility Command-Line Options Mode" For simplicity, not all of ExtUtils::ModuleMaker's default values are represented on \fImodulemaker\fR's menus. Those that are not represented on those menus cannot be changed from there. They \fIcan\fR, however, in many cases be specified as options passed to \fImodulemaker\fR on the command-line and automatically saved as personal defaults by including the \f(CW\*(C`s\*(C'\fR flag as one of those options. If, for example, your name is 'John Q Public' and you want all modules you create to have compact top-level directories, you would call: .PP .Vb 1 \& % modulemaker \-Icsn Sample::Module \-u \*(AqJohn Q Public\*(Aq .Ve .PP A distribution with a top-level directory \fISample-Module\fR would be created. \&'John Q Public' would appear in appropriate places in \&\fISample\-Module/Makefile.PL\fR and \fISample\-Module/lib/Sample/Module.pm\fR. You could then throw away the entire \fISample-Module\fR directory tree. The \fInext\fR time you call \f(CW\*(C`modulemaker\*(C'\fR, the call .PP .Vb 1 \& % modulemaker \-In Second::Module .Ve .PP would suffice to generate a compact top-level directory and 'John Q Public' would appear in appropriate locations instead of the dreaded 'A. U. Thor'. .ie n .SS "Via ""ExtUtils::ModuleMaker::new()""" .el .SS "Via \f(CWExtUtils::ModuleMaker::new()\fP" .IX Subsection "Via ExtUtils::ModuleMaker::new()" In \fIall\fR cases, ExtUtils::ModuleMaker's default values can be overridden with arguments passed to \f(CW\*(C`new()\*(C'\fR inside a Perl program. The overriding can then be made permanent by calling \f(CW\*(C`make_selections_defaults()\*(C'\fR. .PP Suppose, for example, .IP "1." 4 that you want the files in your test suite to appear in a numerical order starting from \f(CW0\fR rather than ExtUtils::ModuleMaker's own default starting point of \f(CW1\fR; .IP "2." 4 that you want the number in the test file's name to be formatted as a two-digit string padded with zeroes rather than ExtUtils::ModuleMaker's own default format of a three-digit, zero-padded string; .IP "3." 4 that you want the numerical part of the test filename to be joined to the lexical part with a dot (\f(CW\*(C`.\*(C'\fR) rather than ExtUtils::ModuleMaker's own default linkage character of an underscore (\f(CW\*(C`_\*(C'\fR); and .IP "4." 4 that you want the lexical part of the test filename to reflect the module's name rather than ExtUtils::ModuleMaker's default of \f(CW\*(C`load\*(C'\fR. .PP Your Perl program would look like this: .PP .Vb 4 \& #!/usr/local/bin/perl \& use strict; \& use warnings; \& use ExtUtils::ModuleMaker; \& \& my $mod = ExtUtils::ModuleMaker\->new( \& NAME => \*(AqSample::Module\*(Aq, \& AUTHOR => \*(AqJohn Q Public\*(Aq, \& COMPACT => 1, \& FIRST_TEST_NUMBER => 0, \& TEST_NUMBER_FORMAT => "%02d", \& TEST_NAME_SEPARATOR => q{.}, \& TEST_NAME_DERIVED_FROM_MODULE_NAME => 1, \& ); \& \& $mod\->make_selections_defaults(); .Ve .PP A subsequent call to the \fImodulemaker\fR utility, .PP .Vb 1 \& % modulemaker \-In Second::Balcony::Jump .Ve .PP would generate a directory tree with a compact top-level, 'John Q Public' in appropriate locations in \fISecond\-Balcony\-Jump/Makefile.PL\fR and \&\fISecond\-Balcony\-Jump/lib/Second/Balcony/Jump.pm\fR and a test file called \&\fISecond\-Balcony\-Jump/t/00.Second.Balcony.Jump.t\fR. .SS "Via Subclassing ExtUtils::ModuleMaker" .IX Subsection "Via Subclassing ExtUtils::ModuleMaker" If you're a power-user, once you start playing with ExtUtils::ModuleMaker, you won't be able to stop. You'll ask yourself, \*(L"Self, if I can change the default values, why can't I change the 'boilerplate' copy that appears inside the files which ExtUtils::ModuleMaker creates?\*(R" .PP Now, you can. You can hack on the methods which \&\f(CW\*(C`ExtUtils::ModuleMaker::new()\*(C'\fR and \f(CW\*(C`complete_build()\*(C'\fR call internally to customize their results to your heart's desire. The key: build an entirely new Perl extension whose \fIlib/*.pm\fR file has methods that override the methods you need overridden \*(-- and \fIonly\fR those methods. Follow these steps: .PP \fI1. Study \fIExtUtils::ModuleMaker::Defaults\fI, \fI::Initializers\fI and \fI::StandardText\fI\fR .IX Subsection "1. Study ExtUtils::ModuleMaker::Defaults, ::Initializers and ::StandardText" .PP ExtUtils::ModuleMaker's default values are stored in \&\fIlib/ExtUtils/ModuleMaker/Defaults.pm\fR, specifically, in its \&\f(CW\*(C`default_values()\*(C'\fR method. Identify those values which you wish to change. .PP ExtUtils::ModuleMaker's other internal methods are found in two other files: \&\fI/lib/ExtUtils/ModuleMaker/Initializers.pm\fR and \&\fIlib/ExtUtils/ModuleMaker/StandardText.pm\fR. Rule of thumb: If an internal method is called within \f(CW\*(C`new()\*(C'\fR, it is found in ExtUtils::ModuleMaker::Initializers. If it is called within \&\f(CW\*(C`complete_build()\*(C'\fR, it is found in ExtUtils::ModuleMaker::StandardText. Study these two packages to identify the methods you wish to override. .PP \&\fIHint:\fR If changing a default value in ExtUtils::ModuleMaker::Defaults will achieve your objective, make that change rather than trying to override methods in ExtUtils::ModuleMaker::Initializers or ExtUtils::ModuleMaker::StandardText. .PP \&\fIHint:\fR You should probably think about overriding methods in ExtUtils::ModuleMaker::StandardText before overriding those in ExtUtils::ModuleMaker::Initializers. .PP \fI2. Use \fImodulemaker\fI to Create the Framework for a New Distribution\fR .IX Subsection "2. Use modulemaker to Create the Framework for a New Distribution" .PP You're creating a new Perl extension. Who ya gonna call? \fImodulemaker\fR, natch! (If you have not read the documentation for \fImodulemaker\fR by this point, do so now.) .PP Suppose that you've gotten on the 'Perl Best Practices' bandwagon and want to create all your Perl extensions in the style recommended by Damian Conway in the book of the same name. Use \fImodulemaker\fR to create the framework: .PP .Vb 5 \& % modulemaker \-Icqn ExtUtils::ModuleMaker::PBP \e \& \-u \*(AqJames E Keenan\*(Aq \e \& \-p JKEENAN \e \& \-o \*(AqPerl Seminar NY\*(Aq \e \& \-w http://search.cpan.org/~jkeenan/ .Ve .PP You used the \f(CW\*(C`\-q\*(C'\fR option above because you do \fInot\fR want or need a constructor in the new package you are creating. That package will \fIinherit\fR its constructor from ExtUtils::ModuleMaker. .PP \fI3. Edit the \fIlib/*.pm\fI File\fR .IX Subsection "3. Edit the lib/*.pm File" .PP Open up the best text-editor at your disposal and proceed to hack: .PP .Vb 1 \& % vi ExtUtils\-ModuleMaker\-PBP/lib/ExtUtils/ModuleMaker/PBP.pm .Ve .PP Add this line near the top of the file: .PP .Vb 1 \& use base qw{ ExtUtils::ModuleMaker }; .Ve .PP so that ExtUtils::ModuleMaker::PBP inherits from ExtUtils::ModuleMaker (which, in turn, inherits from ExtUtils::ModuleMaker::Defaults, ExtUtils::ModuleMaker::Initializers and ExtUtils::ModuleMaker::StandardText). .PP If you have carefully studied ExtUtils::ModuleMaker::Defaults, ExtUtils::ModuleMaker::StandardText and \fIPerl Best Practices\fR, you will write methods including the following: .PP .Vb 10 \& sub default_values { \& my $self = shift; \& my $defaults_ref = $self\->SUPER::default_values(); \& $defaults_ref\->{COMPACT} = 1; \& $defaults_ref\->{FIRST_TEST_NUMBER} = 0; \& $defaults_ref\->{TEST_NUMBER_FORMAT} = "%02d"; \& $defaults_ref\->{EXTRA_MODULES_SINGLE_TEST_FILE} = 1; \& $defaults_ref\->{TEST_NAME_SEPARATOR} = q{.}; \& $defaults_ref\->{INCLUDE_TODO} = 0; \& $defaults_ref\->{INCLUDE_POD_COVERAGE_TEST} = 1; \& $defaults_ref\->{INCLUDE_POD_TEST} = 1; \& return $defaults_ref;; \& } \& \& sub text_Makefile { \& my $self = shift; \& my $Makefile_format = q~ \& use strict; \& use warnings; \& use ExtUtils::MakeMaker; \& \& WriteMakefile( \& NAME => \*(Aq%s\*(Aq, \& AUTHOR => \*(Aq%s <%s>\*(Aq, \& VERSION_FROM => \*(Aq%s\*(Aq, \& ABSTRACT_FROM => \*(Aq%s\*(Aq, \& PL_FILES => {}, \& PREREQ_PM => { \& \*(AqTest::More\*(Aq => 0, \& \*(Aqversion\*(Aq => 0, \& }, \& dist => { COMPRESS => \*(Aqgzip \-9f\*(Aq, SUFFIX => \*(Aqgz\*(Aq, }, \& clean => { FILES => \*(Aq%s\-*\*(Aq }, \& ); \& ~; \& my $text_of_Makefile = sprintf $Makefile_format, \& map { my $s = $_; $s =~ s{\*(Aq}{\e\e\*(Aq}g; $s; } \& $self\->{NAME}, \& $self\->{AUTHOR}, \& $self\->{EMAIL}, \& $self\->{FILE}, \& $self\->{FILE}, \& $self\->{FILE}; \& return $text_of_Makefile; \& } .Ve .PP Of course, for true Perl laziness, you'll use \s-1CPAN\s0 distribution ExtUtils::ModuleMaker::PBP, written by the author of ExtUtils::ModuleMaker as an exemplar of subclassing ExtUtils::ModuleMaker and generating the same output as Damian Conway's Module::Starter::PBP. .PP \fI4. Test\fR .IX Subsection "4. Test" .PP How do you know you have correctly subclassed ExtUtils::ModuleMaker? With a test suite, of course. With careful editing, you can use many of ExtUtils::ModuleMaker's own tests in your new distribution. You will, of course, have to change a number of tests, because the default values implied by Conway's recommendations are different from ExtUtils::ModuleMaker's own defaults. Among other things, you will have to do a search-and-replace on all constructor calls. .PP .Vb 1 \& % perl \-pi\*(Aq*.bak\*(Aq \-e \*(Aqs{ExtUtils::ModuleMaker\->new}{ExtUtils::ModuleMaker::PBP\->new}g;\*(Aq .Ve .PP Of course, you \fIshould\fR have written your tests first, right? .PP \fI5. Install and Use\fR .IX Subsection "5. Install and Use" .PP You would install your new distribution as you would any other Perl distribution, \fIi.e.,\fR with either ExtUtils::MakeMaker or Module::Build, depending on which you chose in creating your subclass. .PP .Vb 4 \& #!/usr/local/bin/perl \& use strict; \& use warnings; \& use ExtUtils::ModuleMaker::PBP; \& \& my $mod = ExtUtils::ModuleMaker::PBP\->new( \& NAME => \*(AqSample::Module\*(Aq, \& ); \& \& $mod\->complete_build(); .Ve .PP For an adaptation of the \fImodulemaker\fR utility to work with ExtUtils::ModuleMaker::PBP, see \fImmkrpbp\fR which is bundled with the latter package. .PP \fIAn Alternative Approach to Subclassing\fR .IX Subsection "An Alternative Approach to Subclassing" .PP There is one other way to subclass to ExtUtils::ModuleMaker which bears mentioning, more because the author used it in the development of this version of ExtUtils::ModuleMaker than because it is recommended. If for some reason you do not wish to create a full-fledged Perl distribution for your subclass, you can simply write the subclassing package and store it in the same directory hierarchy on your system in which your personal defaults file is stored. .PP For example, suppose you are experimenting and only wish to override one method in ExtUtils::ModuleMaker::StandardText. You can create a package called ExtUtils::ModuleMaker::AlternativeText. If you are working on a Unix-like system, you would move that file such that its path would be: .PP .Vb 1 \& "$ENV{HOME}/.modulemaker/ExtUtils/ModuleMaker/AlternativeText.pm" .Ve .PP You would then add one argument to your call to \&\f(CW\*(C`ExtUtils::ModuleMaker::new()\*(C'\fR: .PP .Vb 4 \& my $mod = ExtUtils::ModuleMaker\->new( \& NAME => \*(AqSample::Module\*(Aq, \& ALT_BUILD => \*(AqExtUtils::ModuleMaker::AlternativeText\*(Aq, \& ); .Ve .SH "CAVEATS" .IX Header "CAVEATS" .IP "\(bu" 4 Require Perl 5.6.1 .Sp Support for versions of Perl earlier than 5.6.1 was dropped in version 0.57 released in May 2018. .IP "\(bu" 4 Testing of \fImodulemaker\fR's Interactive Mode .Sp The easiest, laziest and recommended way of using this distribution is the command-line utility \fImodulemaker\fR, especially its interactive mode. However, this is necessarily the most difficult test, as its testing would require capturing the \s-1STDIN, STDOUT\s0 and \s-1STDERR\s0 for a process spawned by a \f(CW\*(C`system(\*(Aqmodulemaker\*(Aq)\*(C'\fR call from within a test file. For now, the maintainer has relied on repeated visual inspection of the screen prompts generated by \fImodulemaker\fR. With luck, \fIExpect\fR\-based tests will be available in a future version. .IP "\(bu" 4 Testing \fImodulemaker\fR on Non\-*nix\-Like Operating Systems .Sp Since testing the \fImodulemaker\fR utility from within the test suite requires a \f(CW\*(C`system()\*(C'\fR call, a clean test run depends in part on the way a given operating system parses command-line arguments. The maintainer has tested this on Darwin and Win32 and, thanks to a suggestion by A. Sinan Unur, solved a problem on Win32. Results on other operating systems may differ; feedback is welcome. .SH "TO DO" .IX Header "TO DO" .IP "\(bu" 4 Tests for \fImodulemaker\fR's interactive mode. .IP "\(bu" 4 Possible new \f(CW\*(C`USE_AS_BASE\*(C'\fR attribute which would insert modules from which user's new module will inherit. .Sp .Vb 6 \& USE_AS_BASE => [ qw| \& Template::Toolkit \& Module::Build \& Lingua::Romana::Perligata \& Acme::Buffy \& | ], .Ve .Sp Such an attribute would require replacement copy for \&\f(CW\*(C`ExtUtils::ModuleMaker::StandardText::block_begin()\*(C'\fR. .SH "AUTHOR/MAINTAINER" .IX Header "AUTHOR/MAINTAINER" ExtUtils::ModuleMaker was originally written in 2001\-02 by R. Geoffrey Avery (modulemaker [at] PlatypiVentures [dot] com). Since version 0.33 (July 2005) it has been maintained by James E. Keenan (jkeenan [at] cpan [dot] org). .SH "SUPPORT" .IX Header "SUPPORT" Send email to jkeenan [at] cpan [dot] org. Please include 'modulemaker' in the subject line. Please report any bugs or feature requests to \&\f(CW\*(C`bug\-ExtUtils\-ModuleMaker@rt.cpan.org\*(C'\fR, or through the web interface at . .PP Development repository: .SH "ACKNOWLEDGMENTS" .IX Header "ACKNOWLEDGMENTS" Thanks first and foremost to Geoff Avery for creating ExtUtils::ModuleMaker and popularizing it via presentations I attended at \s-1YAPC::NA::2003\s0 (Boca Raton) and \s-1YAPC::EU::2003\s0 (Paris). .PP Soon after I took over maintenance of ExtUtils::ModuleMaker, David A Golden became a driving force in its ongoing development, providing suggestions for additional functionality as well as bug reports. David is the author of ExtUtils::ModuleMaker::TT which, while not a pure subclass of ExtUtils::ModuleMaker, extends its functionality for users of Template::Toolkit. .PP Thanks for suggestions about testing the \fImodulemaker\fR utility to Michael G Schwern on perl.qa and A Sinan Unur and Paul Lalli on comp.lang.perl.misc. Thanks for help in dealing with a nasty bug in the testing to Perlmonks davidrw and tlm. That well known Perl hacker, Anonymous Guest, contributed another bug report on rt.cpan.org. .PP As development proceeded, several issues were clarified by members of Perlmonks.org. CountZero, xdg, Tanktalus, holli, TheDamian and nothingmuch made particularly useful suggestions, as did Brian Clarkson. .PP Thanks also go to the following beta testers: Alex Gill, Marc Prewitt, Scott Godin, Reinhard Urban and imacat. .PP Version 0.39 of ExtUtils::ModuleMaker encountered spurious testing failure reports from testers.cpan.org. These were eventually diagnosed as being due to bugs in the automated testing programs and/or their operating environments on different systems \*(-- \fIi.e.,\fR to problems outside ExtUtils::ModuleMaker itself. Several Perlmonks helped investigate this problem: chromatic, dave_the_m, randyk, and njh. .PP Thanks to Paul M Sirianni for reporting bugs that led to versions 0.48 and 0.51. .PP Thanks to Chris Kirke for pointing to reports at http://cpants.cpanauthors.org/dist/ExtUtils\-ModuleMaker of inconsistent \&\f(CW$VERSION\fR numbers across the component files. .SH "COPYRIGHT" .IX Header "COPYRIGHT" Copyright (c) 2001\-2002 R. Geoffrey Avery. Revisions from v0.33 forward (c) 2005\-2015 James E. Keenan. All rights reserved. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. .PP The full text of the license can be found in the \&\s-1LICENSE\s0 file included with this module. .SH "DISCLAIMER OF WARRANTY" .IX Header "DISCLAIMER OF WARRANTY" \&\s-1BECAUSE THIS SOFTWARE IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY FOR THE SOFTWARE, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE SOFTWARE \*(L"AS IS\*(R" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR, OR CORRECTION.\s0 .PP \&\s-1IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR REDISTRIBUTE THE SOFTWARE AS PERMITTED BY THE ABOVE LICENCE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL, OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE SOFTWARE\s0 (\s-1INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE SOFTWARE TO OPERATE WITH ANY OTHER SOFTWARE\s0), \s-1EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES.\s0 .SH "SEE ALSO" .IX Header "SEE ALSO" \&\fImodulemaker\fR, \fIperlnewmod\fR, \fIh2xs\fR, \fIExtUtils::MakeMaker\fR, \fIModule::Build\fR, \&\fIExtUtils::ModuleMaker::PBP\fR, \fIExtUtils::ModuleMaker::TT\fR, \fImmkrpbp\fR.