⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 module::build::api.3

📁 视频监控网络部分的协议ddns,的模块的实现代码,请大家大胆指正.
💻 3
📖 第 1 页 / 共 5 页
字号:
.SpA hash of key/value pairs that should be merged into the \fI\s-1META\s0.yml\fRfile during the \f(CW\*(C`distmeta\*(C'\fR action.  Any existing entries with thesame names will be overridden..SpThe only difference between \f(CW\*(C`meta_add\*(C'\fR and \f(CW\*(C`meta_merge\*(C'\fR is theirbehavior on hash-valued and array-valued entries: \f(CW\*(C`meta_add\*(C'\fR willcompletely 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 orarray value..SpSee the \*(L"\s-1MODULE\s0 \s-1METADATA\s0\*(R" section for details..IP "module_name" 4.IX Item "module_name"[version 0.03].SpThe \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 themajority 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 willdefault to \f(CW\*(C`lib/Foo/Bar.pm\*(C'\fR.  \f(CW\*(C`dist_version_from\*(C'\fR will in turn beused to set \f(CW\*(C`dist_version\*(C'\fR..SpSetting \f(CW\*(C`module_name\*(C'\fR won't override a \f(CW\*(C`dist_*\*(C'\fR parameter youspecify explicitly..IP "PL_files" 4.IX Item "PL_files"[version 0.06].SpAn optional parameter specifying a set of \f(CW\*(C`.PL\*(C'\fR files in yourdistribution.  These will be run as Perl scripts prior to processingthe rest of the files in your distribution.  They are usually used astemplates 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..SpThe files are specified with the \f(CW\*(C`.PL\*(C'\fR files as hash keys, and thefile(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.SpNote that the path specifications are \fIalways\fR given in Unix-likeformat, not in the style of the local system..SpIf your \f(CW\*(C`.PL\*(C'\fR scripts don't create any files, or if they create fileswith unexpected names, or even if they create multiple files, you canindicate that so that Module::Build can properly handle these createdfiles:.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.IP "pm_files" 4.IX Item "pm_files"[version 0.19].SpAn optional parameter specifying the set of \f(CW\*(C`.pm\*(C'\fR files in thisdistribution, specified as a hash reference whose keys are the files'locations in the distributions, and whose values are their logicallocations based on their package name, i.e. where they would be foundin a \*(L"normal\*(R" Module::Build\-style distribution.  This parameter ismainly intended to support alternative layouts of files..SpFor instance, if you have an old-style MakeMaker distribution for amodule called \f(CW\*(C`Foo::Bar\*(C'\fR and a \fIBar.pm\fR file at the top level of thedistribution, you could specify your layout in your \f(CW\*(C`Build.PL\*(C'\fR likethis:.Sp.Vb 6\&  my $build = Module::Build\->new\&    (\&     module_name => \*(AqFoo::Bar\*(Aq,\&     ...\&     pm_files => { \*(AqBar.pm\*(Aq => \*(Aqlib/Foo/Bar.pm\*(Aq },\&    );.Ve.SpNote that the values should include \f(CW\*(C`lib/\*(C'\fR, because this is wherethey would be found in a \*(L"normal\*(R" Module::Build\-style distribution..SpNote also that the path specifications are \fIalways\fR given inUnix-like format, not in the style of the local system..IP "pod_files" 4.IX Item "pod_files"[version 0.19].SpJust like \f(CW\*(C`pm_files\*(C'\fR, but used for specifying the set of \f(CW\*(C`.pod\*(C'\fRfiles in your distribution..IP "recommends" 4.IX Item "recommends"[version 0.08].SpThis is just like the \*(L"requires\*(R" argument, except that modules listedin this section aren't essential, just a good idea.  We'll just printa friendly warning if one of these modules aren't found, but we'llcontinue running..SpIf a module is recommended but not required, all tests should stillpass if the module isn't installed.  This may mean that some testsmay be skipped if recommended dependencies aren't present..SpAutomated tools like \s-1CPAN\s0.pm should inform the user when recommendedmodules aren't installed, and it should offer to install them if itwants to be helpful..SpSee the documentation for \*(L"\s-1PREREQUISITES\s0\*(R" in Module::Build::Authoringfor the details of how requirements can be specified..IP "recursive_test_files" 4.IX Item "recursive_test_files"[version 0.28].SpNormally, \f(CW\*(C`Module::Build\*(C'\fR does not search subdirectories when lookingfor tests to run. When this options is set it will search recursivelyin all subdirectories of the standard 't' test directory..IP "requires" 4.IX Item "requires"[version 0.07].SpAn optional \f(CW\*(C`requires\*(C'\fR argument specifies any module prerequisitesthat the current module depends on..SpOne note: currently \f(CW\*(C`Module::Build\*(C'\fR doesn't actually \fIrequire\fR theuser to have dependencies installed, it just strongly urges.  In thefuture we may require it.  There's also a \*(L"recommends\*(R" section forthings that aren't absolutely required..SpAutomated tools like \s-1CPAN\s0.pm should refuse to install a module if oneof its dependencies isn't satisfied, unless a \*(L"force\*(R" command is givenby the user.  If the tools are helpful, they should also offer toinstall the dependencies..SpA synonym for \f(CW\*(C`requires\*(C'\fR is \f(CW\*(C`prereq\*(C'\fR, to help succour peopletransitioning from \f(CW\*(C`ExtUtils::MakeMaker\*(C'\fR.  The \f(CW\*(C`requires\*(C'\fR term ispreferred, but the \f(CW\*(C`prereq\*(C'\fR term will remain valid in futuredistributions..SpSee the documentation for \*(L"\s-1PREREQUISITES\s0\*(R" in Module::Build::Authoringfor the details of how requirements can be specified..IP "script_files" 4.IX Item "script_files"[version 0.18].SpAn optional parameter specifying a set of files that should beinstalled as executable Perl scripts when the module is installed.May be given as an array reference of the files, or as a hashreference whose keys are the files (and whose values will currently beignored)..SpThe default is to install no script files \- in other words, there isno default location where Module::Build will look for script files toinstall..SpFor backward compatibility, you may use the parameter \f(CW\*(C`scripts\*(C'\fRinstead of \f(CW\*(C`script_files\*(C'\fR.  Please consider this usage deprecated,though it will continue to exist for several version releases..IP "sign" 4.IX Item "sign"[version 0.16].SpIf a true value is specified for this parameter, Module::Signaturewill be used (via the 'distsign' action) to create a \s-1SIGNATURE\s0 filefor 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)..SpThe default value is false.  In the future, the default may change totrue if you have \f(CW\*(C`Module::Signature\*(C'\fR installed on your system..IP "test_files" 4.IX Item "test_files"[version 0.23].SpAn 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'\fRaction.  May be given as an array reference of the files, or as a hashreference whose keys are the files (and whose values will currently beignored).  If the argument is given as a single string (not in anarray reference), that string will be treated as a \f(CW\*(C`glob()\*(C'\fR patternspecifying the files to use..SpThe default is to look for a \fItest.pl\fR script in the top-leveldirectory 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'\fRproperty is true, then the \f(CW\*(C`t/\*(C'\fR directory will be scanned recursivelyfor \f(CW\*(C`*.t\*(C'\fR files..IP "xs_files" 4.IX Item "xs_files"[version 0.19].SpJust like \f(CW\*(C`pm_files\*(C'\fR, but used for specifying the set of \f(CW\*(C`.xs\*(C'\fRfiles in your distribution..RE.RS 4.RE.IP "new_from_context(%args)" 4.IX Item "new_from_context(%args)"[version 0.28].SpWhen called from a directory containing a \fIBuild.PL\fR script and a\&\fI\s-1META\s0.yml\fR file (in other words, the base directory of adistribution), this method will run the \fIBuild.PL\fR and return theresulting \f(CW\*(C`Module::Build\*(C'\fR object to the caller.  Any key-valuearguments given to \f(CW\*(C`new_from_context()\*(C'\fR are essentially likecommand line arguments given to the \fIBuild.PL\fR script, so for exampleyou could pass \f(CW\*(C`verbose => 1\*(C'\fR to this method to turn onverbosity..IP "\fIresume()\fR" 4.IX Item "resume()"[version 0.03].SpYou'll probably never call this method directly, it's only called fromthe auto-generated \f(CW\*(C`Build\*(C'\fR script.  The \f(CW\*(C`new()\*(C'\fR method is onlycalled once, when the user runs \f(CW\*(C`perl Build.PL\*(C'\fR.  Thereafter, whenthe user runs \f(CW\*(C`Build test\*(C'\fR or another action, the \f(CW\*(C`Module::Build\*(C'\fRobject is created using the \f(CW\*(C`resume()\*(C'\fR method to re-instantiate withthe settings given earlier to \f(CW\*(C`new()\*(C'\fR..IP "\fIsubclass()\fR" 4.IX Item "subclass()"[version 0.06].SpThis creates a new \f(CW\*(C`Module::Build\*(C'\fR subclass on the fly, as describedin the \*(L"\s-1SUBCLASSING\s0\*(R" in Module::Build::Authoring section.  The callermust 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, anddefaults to \f(CW\*(C`MyModuleBuilder\*(C'\fR.  The \f(CW\*(C`code\*(C'\fR parameter specifies Perlcode to use as the body of the subclass..Sh "\s-1METHODS\s0".IX Subsection "METHODS".IP "add_build_element($type)" 4.IX Item "add_build_element($type)"[version 0.26].SpAdds a new type of entry to the build process.  Accepts a singlestring specifying its type-name.  There must also be a method definedto 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..SpSee 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].SpYou 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 userperforms the \f(CW\*(C`Build clean\*(C'\fR action.  The arguments to the method arepatterns suitable for passing to Perl's \f(CW\*(C`glob()\*(C'\fR function, specifiedin either Unix format or the current machine's native format.  It'susually convenient to use Unix format when you hard-code the filenames(e.g. in \fIBuild.PL\fR) and the native format when the names areprogrammatically generated (e.g. in a testing script)..SpI decided to provide a dynamic method of the \f(CW$build\fR object, ratherthan just use a static list of files named in the \fIBuild.PL\fR, becausethese static lists can get difficult to manage.  I usually prefer tokeep the responsibility for registering temporary files close to thecode 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.SpThis method is the preferred interface for retrieving the arguments passed viacommand line options to \fIBuild.PL\fR or \fIBuild\fR, minus the Module-Buildspecific options..SpWhen called in in a scalar context with no arguments, this method returns areference to the hash storing all of the arguments; in an array context, itreturns the hash itself.  When passed a single argument, it returns the valuestored 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 thefirst 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].SpInvokes the AutoSplit module on the \f(CW$from\fR file, sending theoutput to the \f(CW\*(C`lib/auto\*(C'\fR directory inside \f(CW$to\fR.  \f(CW$to\fR istypically the \f(CW\*(C`blib/\*(C'\fR directory..IP "\fIbase_dir()\fR" 4.IX Item "base_dir()"[version 0.14].SpReturns 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 befound.  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 assoon as it begins execution..IP "\fIbuild_requires()\fR" 4.IX Item "build_requires()"[version 0.21].SpReturns a hash reference indicating the \f(CW\*(C`build_requires\*(C'\fRprerequisites that were passed to the \f(CW\*(C`new()\*(C'\fR method..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

⌨️ 快捷键说明

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