build.pm

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

PM
1,072
字号
package Module::Build;# This module doesn't do much of anything itself, it inherits from the# modules that do the real work.  The only real thing it has to do is# figure out which OS-specific module to pull in.  Many of the# OS-specific modules don't do anything either - most of the work is# done in Module::Build::Base.use strict;use File::Spec ();use File::Path ();use File::Basename ();use Module::Build::Base;use vars qw($VERSION @ISA);@ISA = qw(Module::Build::Base);$VERSION = '0.2808_01';$VERSION = eval $VERSION;# Okay, this is the brute-force method of finding out what kind of# platform we're on.  I don't know of a systematic way.  These values# came from the latest (bleadperl) perlport.pod.my %OSTYPES = qw(		 aix       Unix		 bsdos     Unix		 dgux      Unix		 dragonfly Unix		 dynixptx  Unix		 freebsd   Unix		 linux     Unix		 hpux      Unix		 irix      Unix		 darwin    Unix		 machten   Unix		 midnightbsd Unix		 next      Unix		 openbsd   Unix		 netbsd    Unix		 dec_osf   Unix		 svr4      Unix		 svr5      Unix		 sco_sv    Unix		 unicos    Unix		 unicosmk  Unix		 solaris   Unix		 sunos     Unix		 cygwin    Unix		 os2       Unix		 interix   Unix		 		 dos       Windows		 MSWin32   Windows		 os390     EBCDIC		 os400     EBCDIC		 posix-bc  EBCDIC		 vmesa     EBCDIC		 MacOS     MacOS		 VMS       VMS		 VOS       VOS		 riscos    RiscOS		 amigaos   Amiga		 mpeix     MPEiX		);# Inserts the given module into the @ISA hierarchy between# Module::Build and its immediate parentsub _interpose_module {  my ($self, $mod) = @_;  eval "use $mod";  die $@ if $@;  no strict 'refs';  my $top_class = $mod;  while (@{"${top_class}::ISA"}) {    last if ${"${top_class}::ISA"}[0] eq $ISA[0];    $top_class = ${"${top_class}::ISA"}[0];  }  @{"${top_class}::ISA"} = @ISA;  @ISA = ($mod);}if (grep {-e File::Spec->catfile($_, qw(Module Build Platform), $^O) . '.pm'} @INC) {  __PACKAGE__->_interpose_module("Module::Build::Platform::$^O");} elsif (exists $OSTYPES{$^O}) {  __PACKAGE__->_interpose_module("Module::Build::Platform::$OSTYPES{$^O}");} else {  warn "Unknown OS type '$^O' - using default settings\n";}sub os_type { $OSTYPES{$^O} }sub is_vmsish { return ((os_type() || '') eq 'VMS') }sub is_windowsish { return ((os_type() || '') eq 'Windows') }sub is_unixish { return ((os_type() || '') eq 'Unix') }1;__END__=head1 NAMEModule::Build - Build and install Perl modules=head1 SYNOPSISStandard process for building & installing modules:  perl Build.PL  ./Build  ./Build test  ./Build installOr, if you're on a platform (like DOS or Windows) that doesn't requirethe "./" notation, you can do this:  perl Build.PL  Build  Build test  Build install=head1 DESCRIPTIONC<Module::Build> is a system for building, testing, and installingPerl modules.  It is meant to be an alternative toC<ExtUtils::MakeMaker>.  Developers may alter the behavior of themodule through subclassing in a much more straightforward way thanwith C<MakeMaker>.  It also does not require a C<make> on your system- most of the C<Module::Build> code is pure-perl and written in a verycross-platform way.  In fact, you don't even need a shell, so evenplatforms like MacOS (traditional) can use it fairly easily.  Its onlyprerequisites are modules that are included with perl 5.6.0, and itworks fine on perl 5.005 if you can install a few additional modules.See L<"MOTIVATIONS"> for more comparisons between C<ExtUtils::MakeMaker>and C<Module::Build>.To install C<Module::Build>, and any other module that usesC<Module::Build> for its installation process, do the following:  perl Build.PL       # 'Build.PL' script creates the 'Build' script  ./Build             # Need ./ to ensure we're using this "Build" script  ./Build test        # and not another one that happens to be in the PATH  ./Build installThis illustrates initial configuration and the running of three'actions'.  In this case the actions run are 'build' (the defaultaction), 'test', and 'install'.  Other actions defined so far include:  build                          manifest      clean                          manpages      code                           pardist       config_data                    ppd           diff                           ppmdist       dist                           prereq_report  distcheck                      pure_install  distclean                      realclean     distdir                        retest        distmeta                       skipcheck     distsign                       test          disttest                       testall       docs                           testcover     fakeinstall                    testdb        help                           testpod       html                           testpodcoverage  install                        versioninstallYou can run the 'help' action for a complete list of actions.=head1 GUIDE TO DOCUMENTATIONThe documentation for C<Module::Build> is broken up into three sections:=over=item General Usage (L<Module::Build>)This is the document you are currently reading. It describes basicusage and background information.  Its main purpose is to assist theuser who wants to learn how to invoke and control C<Module::Build>scripts at the command line.=item Authoring Reference (L<Module::Build::Authoring>)This document describes the structure and organization ofC<Module::Build>, and the relevant concepts needed by authors who arewriting F<Build.PL> scripts for a distribution or controllingC<Module::Build> processes programmatically.=item API Reference (L<Module::Build::API>)This is a reference to the C<Module::Build> API.=item Cookbook (L<Module::Build::Cookbook>)This document demonstrates how to accomplish many common tasks.  Itcovers general command line usage and authoring of F<Build.PL>scripts.  Includes working examples.=back=head1 ACTIONSThere are some general principles at work here.  First, each task whenbuilding a module is called an "action".  These actions are listedabove; they correspond to the building, testing, installing,packaging, etc., tasks.Second, arguments are processed in a very systematic way.  Argumentsare always key=value pairs.  They may be specified at C<perl Build.PL>time (i.e. C<perl Build.PL destdir=/my/secret/place>), in which casetheir values last for the lifetime of the C<Build> script.  They mayalso be specified when executing a particular action (i.e.C<Build test verbose=1>), in which case their values last only for thelifetime of that command.  Per-action command line parameters takeprecedence over parameters specified at C<perl Build.PL> time.The build process also relies heavily on the C<Config.pm> module.If the user wishes to override any of thevalues in C<Config.pm>, she may specify them like so:  perl Build.PL --config cc=gcc --config ld=gccThe following build actions are provided by default.=over 4=item build[version 0.01]If you run the C<Build> script without any arguments, it runs theC<build> action, which in turn runs the C<code> and C<docs> actions.This is analogous to the MakeMaker 'make all' target.=item clean[version 0.01]This action will clean up any files that the build process may havecreated, including the C<blib/> directory (but not including theC<_build/> directory and the C<Build> script itself).=item code[version 0.20]This action builds your codebase.By default it just creates a C<blib/> directory and copies any C<.pm>and C<.pod> files from your C<lib/> directory into the C<blib/>directory.  It also compiles any C<.xs> files from C<lib/> and placesthem in C<blib/>.  Of course, you need a working C compiler (probablythe same one that built perl itself) for the compilation to workproperly.The C<code> action also runs any C<.PL> files in your F<lib/>directory.  Typically these create other files, named the same butwithout the C<.PL> ending.  For example, a file F<lib/Foo/Bar.pm.PL>could create the file F<lib/Foo/Bar.pm>.  The C<.PL> files areprocessed first, so any C<.pm> files (or other kinds that we dealwith) will get copied correctly.=item config_data[version 0.26]...=item diff[version 0.14]This action will compare the files about to be installed with theirinstalled counterparts.  For .pm and .pod files, a diff will be shown(this currently requires a 'diff' program to be in your PATH).  Forother files like compiled binary files, we simply report whether theydiffer.A C<flags> parameter may be passed to the action, which will be passedto the 'diff' program.  Consult your 'diff' documentation for theparameters it will accept - a good one is C<-u>:  ./Build diff flags=-u=item dist[version 0.02]This action is helpful for module authors who want to package up theirmodule for source distribution through a medium like CPAN.  It will create atarball of the files listed in F<MANIFEST> and compress the tarball usingGZIP compression.By default, this action will use the external C<tar> and C<gzip>executables on Unix-like platforms, and the C<Archive::Tar> moduleelsewhere.  However, you can force it to use whatever executable youwant by supplying an explicit C<tar> (and optional C<gzip>) parameter:  ./Build dist --tar C:\path\to\tar.exe --gzip C:\path\to\zip.exe=item distcheck[version 0.05]Reports which files are in the build directory but not in theF<MANIFEST> file, and vice versa.  (See L<manifest> for details.)=item distclean[version 0.05]Performs the 'realclean' action and then the 'distcheck' action.=item distdir[version 0.05]Creates a "distribution directory" named C<$dist_name-$dist_version>(if that directory already exists, it will be removed first), thencopies all the files listed in the F<MANIFEST> file to that directory.This directory is what the distribution tarball is created from.=item distmeta[version 0.21]Creates the F<META.yml> file that describes the distribution.F<META.yml> is a file containing various bits of "metadata" about thedistribution.  The metadata includes the distribution name, version,abstract, prerequisites, license, and various other data about thedistribution.  This file is created as F<META.yml> in YAML format.It is recommended that the C<YAML> module be installed to create it.If the C<YAML> module is not installed, an internal module suppliedwith Module::Build will be used to write the META.yml file, and thiswill most likely be fine.F<META.yml> file must also be listed in F<MANIFEST> - if it's not, awarning will be issued.The current version of the F<META.yml> specification can be found atL<http://module-build.sourceforge.net/META-spec-current.html>=item distsign

⌨️ 快捷键说明

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