如何将多个 Perl 模块添加到 Makefile.PL?
正在寻找有关如何将多个 PM 文件添加到 MakeMaker 脚本的见解?
我看到此文档和所有示例看起来像是添加了一个文件,如何添加多个文件?
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Your::Module',
VERSION_FROM => 'lib/Your/Module.pm'
);
我只需添加另一组值吗?
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Your::Module',
VERSION_FROM => 'lib/Your/Module.pm'
NAME => 'Your::Module2',
VERSION_FROM => 'lib/Your/Module2.pm'
);
Looking for some insight on how to add multiple PM files to the MakeMaker script?
I see this documentation and all the examples look like one file is added, how do I add multiple files?
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Your::Module',
VERSION_FROM => 'lib/Your/Module.pm'
);
Do I just add another set of values?
use ExtUtils::MakeMaker;
WriteMakefile(
NAME => 'Your::Module',
VERSION_FROM => 'lib/Your/Module.pm'
NAME => 'Your::Module2',
VERSION_FROM => 'lib/Your/Module2.pm'
);
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
答案是:什么也不做。您的原始代码和布局都很好。 MakeMaker 会在
lib
中找到您的模块,而无需您费力。尝试一下看看。像 toolic 的答案中那样明确写出
PM
是不必要的,而且很脆弱。The answer is: do nothing. Your original code and layout is fine. MakeMaker will find your modules in
lib
without you lifting a finger. Try it and see.Explicitly writing out
PM
as in toolic's answer is unnecessary and brittle.工具的答案已经将您指向文档,但我会回答问题的另一部分(尽管它也在文档中):
NAME
是 Makemaker 用于发行版名称的字符串。尽管这通常是主模块,但它实际上可以是您喜欢的任何模块。VERSION_FROM
告诉 Makemaker 它应该从特定文件中获取$VERSION
并在分发版本中使用它。大多数情况下,人们使用主模块的版本作为分发版本,但您不必这样做。toolic's answer already points you to the docs, but I'll answer the other part of the question (although it is also in the docs):
NAME
is the string Makemaker uses for the distribution name. Although this is often the main module, it can really be anything you like.VERSION_FROM
tells Makemaker that it should take the$VERSION
from a specific file and use that at the distribution version. Most often, people use the version of the main module as the distribution version, but you don't have to do that.也许您可以尝试使用
PM
。 ExtUtils::MakeMaker 文档说:我查看了从 CPAN 下载的其他一些模块以获取其用法示例,我在 GD Makefile.PL 代码:
我怀疑您发布的代码是否有效,因为您传递给 WriteMakefile 函数的哈希具有重复的键。
Perhaps you could try to use
PM
. The ExtUtils::MakeMaker doc says:I went looking through some other modules I downloaded from CPAN for an example of its usage, and I found it in the GD Makefile.PL code:
I doubt the code you posted would work because the hash you are passing to the
WriteMakefile
function has duplicate keys.