我应该使用哪个框架来编写模块? [英] Which framework should I use to write modules?
问题描述
编写模块的最佳框架是什么- ExtUtils :: MakeMaker (h2xs )或 Module :: Build ?
What's the best framework for writing modules -- ExtUtils::MakeMaker (h2xs) or Module::Build?
推荐答案
注意.该建议已过时. Module :: Build已从Perl核心中删除,但作为CPAN模块存在.优点和缺点仍然存在,而我对MakeMaker的看法仍然存在.
NOTE This advice is out of date. Module::Build has been removed from the Perl core but lives on as a CPAN module. The pros and cons still stand, and my opinions about MakeMaker still stand.
作为ExtUtils :: MakeMaker的前维护者,我喜欢推荐Module :: Build,因为MakeMaker令人震惊. Module :: Build更好地组合在一起.但这不是您关心的问题,我将提出给您的麻烦最少"的答案.
As the former maintainer of ExtUtils::MakeMaker, I like to recommend Module::Build because MakeMaker is a horror show. Module::Build is so much better put together. But those aren't your concerns and I'll present my "least hassle for you" answer.
由于在所有Perl中,Module :: Build的支持都不是100%,所以请从MakeMaker开始.如果您要进行任何自定义,请切换到Module :: Build.由于它们的基本布局,选项和界面几乎相同,因此将很轻松.看上去很诱人,请避免使用Module :: Install.
Because Module::Build support is not 100% in place through all of Perl, start with MakeMaker. If you want to do any customization at all, switch to Module::Build. Since their basic layout, options and interface are almost identical this will be painless. As seductive as it looks, avoid Module::Install.
幸运的是,Module :: Build可以模拟MakeMaker,这可以帮助一些人,但是如果您要进行任何自定义,则无济于事.参见 Module :: Build :: Compat .
Fortunately, Module::Build can emulate MakeMaker which helps some, but doesn't help if you're going to do any customization. See Module::Build::Compat.
对于使用Module :: Build的CPAN发行版来说还不错.现在,在CPAN上有足够的Module :: Build东西了,每个人都已经开始引导它了.
For CPAN releases using Module::Build is fine. There's enough Module::Build stuff on CPAN now that everyone's dealt with getting it bootstrapped already.
最后,新的 configure_requires
选项允许CPAN外壳在开始构建模块之前,他们先知道要安装Module :: Build.不幸的是,只有最新的CPAN shell才了解configure_requires.
Finally, the new configure_requires
option lets CPAN shells know to install Module::Build before they can start building the module. Unfortunately only the latest CPAN shells know about configure_requires.
哦,无论做什么,都不要使用h2xs(除非您正在编写XS代码...甚至还要考虑一下).
Oh, whatever you do don't use h2xs (unless you're writing XS code... and even then think about it).
- 与Perl一起提供,并由Perl内核使用(因此它是活跃的 保持下去,并将永远保持下去
- 一切都知道如何处理Makefile.PL.
- 大多数模块创作文档将涵盖MakeMaker.
- 使用make(那些知道make的人可以调试和修补构建 过程)
- Comes with Perl and used by the Perl core (therefore it is actively maintained and will remain so forever)
- Everything knows what to do with a Makefile.PL.
- Most module authoring documentation will cover MakeMaker.
- Uses make (those who know make can debug and patch the build process)
- 需要make(例如Windows)
- 难以自定义
- 更难以自定义和制作跨平台
- 出现问题时很难调试(除非您了解make)
- 更容易自定义/子类化
- 纯Perl
- 易于调试(Perl)
- 可以通过几种方式模拟MakeMaker
- CPAN shell将为您安装Module :: Build
- Module :: Build维护者(甚至包括所有Perl Toolchain Gang)都讨厌
- 较旧版本的CPAN客户端(包括CPANPLUS)对Module :: Build一无所知.
- 光滑的界面
- 捆绑包本身,您有一个已知的版本
- 一切都知道如何处理Makefile.PL
- 需要化妆
- 始终使用捆绑版,容易受到外部破坏
- 难以在其界面之外进行自定义
- 带有MakeMaker的胆量,所以新的MakeMaker版本最终会破坏它.
- 不知道如何使用v2元规范生成META文件 (越来越多的新工具问题)
- Requires make
- Always uses bundled version, vulnerable to external breakage
- Difficult to customize outside its interface
- Mucks with the guts of MakeMaker so a new MakeMaker release will eventually break it.
- Does not know how to generate a META file using the v2 meta-spec (increasingly a problem with newer tools)
这篇关于我应该使用哪个框架来编写模块?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!