build.pm

来自「视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.」· PM 代码 · 共 1,072 行 · 第 1/3 页

PM
1,072
字号
Suppresses the check upon startup that the version of Module::Buildwe're now running under is the same version that was initially invokedwhen building the distribution (i.e. when the C<Build.PL> script wasfirst run).  Use with caution.=back=head2 Default Options File (F<.modulebuildrc>)[version 0.28]When Module::Build starts up, it will look first for a file,F<$ENV{HOME}/.modulebuildrc>.  If it's not found there, it will lookin the the F<.modulebuildrc> file in the directories referred to bythe environment variables C<HOMEDRIVE> + C<HOMEDIR>, C<USERPROFILE>,C<APPDATA>, C<WINDIR>, C<SYS$LOGIN>.  If the file exists, the optionsspecified there will be used as defaults, as if they were typed on thecommand line.  The defaults can be overridden by specifying new valueson the command line.The action name must come at the beginning of the line, followed by anyamount of whitespace and then the options.  Options are given the sameas they would be on the command line.  They can be separated by anyamount of whitespace, including newlines, as long there is whitespace atthe beginning of each continued line.  Anything following a hash mark (C<#>)is considered a comment, and is stripped before parsing.  If more thanone line begins with the same action name, those lines are merged intoone set of options.Besides the regular actions, there are two special pseudo-actions: thekey C<*> (asterisk) denotes any global options that should be appliedto all actions, and the key 'Build_PL' specifies options to be appliedwhen you invoke C<perl Build.PL>.  *        verbose=1   # global options  diff     flags=-u  install  --install_base /home/ken           --install_path html=/home/ken/docs/htmlIf you wish to locate your resource file in a different location, youcan set the environment variable 'MODULEBUILDRC' to the completeabsolute path of the file containing your options.=head1 INSTALL PATHS[version 0.19]When you invoke Module::Build's C<build> action, it needs to figureout where to install things.  The nutshell version of how this worksis that default installation locations are determined fromF<Config.pm>, and they may be overridden by using the C<install_path>parameter.  An C<install_base> parameter lets you specify analternative installation root like F</home/foo>, and a C<destdir> letsyou specify a temporary installation directory like F</tmp/install> incase you want to create bundled-up installable packages.Natively, Module::Build provides default installation locations forthe following types of installable items:=over 4=item libUsually pure-Perl module files ending in F<.pm>.=item arch"Architecture-dependent" module files, usually produced by compilingXS, Inline, or similar code.=item scriptPrograms written in pure Perl.  In order to improve reuse, try to makethese as small as possible - put the code into modules wheneverpossible.=item bin"Architecture-dependent" executable programs, i.e. compiled C code orsomething.  Pretty rare to see this in a perl distribution, but ithappens.=item bindocDocumentation for the stuff in C<script> and C<bin>.  Usuallygenerated from the POD in those files.  Under Unix, these are manualpages belonging to the 'man1' category.=item libdocDocumentation for the stuff in C<lib> and C<arch>.  This is usuallygenerated from the POD in F<.pm> files.  Under Unix, these are manualpages belonging to the 'man3' category.=item binhtmlThis is the same as C<bindoc> above, but applies to html documents.=item libhtmlThis is the same as C<bindoc> above, but applies to html documents.=backFour other parameters let you control various aspects of howinstallation paths are determined:=over 4=item installdirsThe default destinations for these installable things come fromentries in your system's C<Config.pm>.  You can select from threedifferent sets of default locations by setting the C<installdirs>parameter as follows:                          'installdirs' set to:                   core          site                vendor              uses the following defaults from Config.pm:  lib     => installprivlib  installsitelib      installvendorlib  arch    => installarchlib  installsitearch     installvendorarch  script  => installscript   installsitebin      installvendorbin  bin     => installbin      installsitebin      installvendorbin  bindoc  => installman1dir  installsiteman1dir  installvendorman1dir  libdoc  => installman3dir  installsiteman3dir  installvendorman3dir  binhtml => installhtml1dir installsitehtml1dir installvendorhtml1dir [*]  libhtml => installhtml3dir installsitehtml3dir installvendorhtml3dir [*]  * Under some OS (eg. MSWin32) the destination for html documents is    determined by the C<Config.pm> entry C<installhtmldir>.The default value of C<installdirs> is "site".  If you're creatingvendor distributions of module packages, you may want to do somethinglike this:  perl Build.PL --installdirs vendoror  ./Build install --installdirs vendorIf you're installing an updated version of a module that was includedwith perl itself (i.e. a "core module"), then you may setC<installdirs> to "core" to overwrite the module in its presentlocation.(Note that the 'script' line is different from MakeMaker -unfortunately there's no such thing as "installsitescript" or"installvendorscript" entry in C<Config.pm>, so we use the"installsitebin" and "installvendorbin" entries to at least get thegeneral location right.  In the future, if C<Config.pm> adds some moreappropriate entries, we'll start using those.)=item install_pathOnce the defaults have been set, you can override them.On the command line, that would look like this:  perl Build.PL --install_path lib=/foo/lib --install_path arch=/foo/lib/archor this:  ./Build install --install_path lib=/foo/lib --install_path arch=/foo/lib/arch=item install_baseYou can also set the whole bunch of installation paths by supplying theC<install_base> parameter to point to a directory on your system.  Forinstance, if you set C<install_base> to "/home/ken" on a Linuxsystem, you'll install as follows:  lib     => /home/ken/lib/perl5  arch    => /home/ken/lib/perl5/i386-linux  script  => /home/ken/bin  bin     => /home/ken/bin  bindoc  => /home/ken/man/man1  libdoc  => /home/ken/man/man3  binhtml => /home/ken/html  libhtml => /home/ken/htmlNote that this is I<different> from how MakeMaker's C<PREFIX>parameter works.  C<install_base> just gives you a default layout under thedirectory you specify, which may have little to do with theC<installdirs=site> layout.The exact layout under the directory you specify may vary by system -we try to do the "sensible" thing on each platform.=item destdirIf you want to install everything into a temporary directory first(for instance, if you want to create a directory tree that a packagemanager like C<rpm> or C<dpkg> could create a package from), you canuse the C<destdir> parameter:  perl Build.PL --destdir /tmp/fooor  ./Build install --destdir /tmp/fooThis will effectively install to "/tmp/foo/$sitelib","/tmp/foo/$sitearch", and the like, except that it will useC<File::Spec> to make the pathnames work correctly on whateverplatform you're installing on.=item prefixProvided for compatibility with ExtUtils::MakeMaker's PREFIX argument.C<prefix> should be used when you wish Module::Build to install yourmodules, documentation and scripts in the same placeExtUtils::MakeMaker does.The following are equivalent.    perl Build.PL --prefix /tmp/foo    perl Makefile.PL PREFIX=/tmp/fooBecause of the very complex nature of the prefixification logic, thebehavior of PREFIX in MakeMaker has changed subtly over time.Module::Build's --prefix logic is equivalent to the PREFIX logic foundin ExtUtils::MakeMaker 6.30.If you do not need to retain compatibility with ExtUtils::MakeMaker orare starting a fresh Perl installation we recommand you useC<install_base> instead (and C<INSTALL_BASE> in ExtUtils::MakeMaker).See L<Module::Build::Cookbook/Instaling in the same location asExtUtils::MakeMaker> for further information.=back=head1 MOTIVATIONSThere are several reasons I wanted to start over, and not just fixwhat I didn't like about MakeMaker:=over 4=item *I don't like the core idea of MakeMaker, namely that C<make> should beinvolved in the build process.  Here are my reasons:=over 4=item +When a person is installing a Perl module, what can you assume abouttheir environment?  Can you assume they have C<make>?  No, but you canassume they have some version of Perl.=item +When a person is writing a Perl module for intended distribution, canyou assume that they know how to build a Makefile, so they cancustomize their build process?  No, but you can assume they know Perl,and could customize that way.=backFor years, these things have been a barrier to people getting thebuild/install process to do what they want.=item *There are several architectural decisions in MakeMaker that make itvery difficult to customize its behavior.  For instance, when usingMakeMaker you do C<use ExtUtils::MakeMaker>, but the object created inC<WriteMakefile()> is actually blessed into a package name that'screated on the fly, so you can't simply subclassC<ExtUtils::MakeMaker>.  There is a workaround C<MY> package that letsyou override certain MakeMaker methods, but only certain explicitlypreselected (by MakeMaker) methods can be overridden.  Also, the methodof customization is very crude: you have to modify a string containingthe Makefile text for the particular target.  Since these stringsaren't documented, and I<can't> be documented (they take on differentvalues depending on the platform, version of perl, version ofMakeMaker, etc.), you have no guarantee that your modifications willwork on someone else's machine or after an upgrade of MakeMaker orperl.=item *It is risky to make major changes to MakeMaker, since it does so manythings, is so important, and generally works.  C<Module::Build> is anentirely separate package so that I can work on it all I want, withoutworrying about backward compatibility.=item *Finally, Perl is said to be a language for system administration.Could it really be the case that Perl isn't up to the task of buildingand installing software?  Even if that software is a bunch of stupidlittle C<.pm> files that just need to be copied from one place toanother?  My sense was that we could design a system to accomplishthis in a flexible, extensible, and friendly manner.  Or die trying.=back=head1 TO DOThe current method of relying on time stamps to determine whether aderived file is out of date isn't likely to scale well, since itrequires tracing all dependencies backward, it runs into problems onNFS, and it's just generally flimsy.  It would be better to use an MD5signature or the like, if available.  See C<cons> for an example. - append to perllocal.pod - add a 'plugin' functionality=head1 AUTHORKen Williams <kwilliams@cpan.org>Development questions, bug reports, and patches should be sent to theModule-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 Subversionrepository at <https://svn.perl.org/modules/Module-Build/trunk/>=head1 COPYRIGHTCopyright (c) 2001-2006 Ken Williams.  All rights reserved.This library is free software; you can redistribute it and/ormodify it under the same terms as Perl itself.=head1 SEE ALSOperl(1), L<Module::Build::Cookbook>, L<Module::Build::Authoring>,L<Module::Build::API>, L<ExtUtils::MakeMaker>, L<YAML>F<META.yml> Specification:L<http://module-build.sourceforge.net/META-spec-current.html>L<http://www.dsmit.com/cons/>L<http://search.cpan.org/dist/PerlBuildSystem/>=cut

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?