简体   繁体   English

我应该将perl'xt'测试上传到CPAN吗?

[英]Should I upload perl 'xt' tests to CPAN?

Some time ago the new thing appeared in the Perl world. 前段时间,新的东西出现在Perl世界中。 The thing is to create xt directory in the module source code and to place there tests that should be run only by author. 问题是在模块源代码中创建xt目录并放置应该只由作者运行的测试。 The idea of xt tests is that they are not run when the module is installed from CPAN. xt测试的想法是,当从CPAN安装模块时,它们不会运行。

I was thinking that if the tests are not needed for the installation process there is no need to upload that tests to CPAN. 我在想如果安装过程不需要测试,则无需将测试上传到CPAN。 My idea was to have these tests in my VSC, but not to put them in the tar.gz file this is uploaded to CPAN. 我的想法是在我的VSC中进行这些测试,但不要将它们放在tar.gz文件中,而是将其上传到CPAN。

But now there are a lot of CPAN modules that have xt directory in it. 但是现在有很多CPAN模块都有xt目录。 I have a local CPAN copy and I searched for such modules: 我有一个本地的CPAN副本,我搜索了这样的模块:

$ find -iname "*.tar*" -exec tar tf {} \; | grep "/xt/" &> modules_with_xt_dir
$ cat modules_with_xt_dir |sort --random-sort|uniq|head
CatalystX-Dispatcher-AsGraph-0.01/xt/03_pod.t
Religion-Bible-Reference-0.014/xt/release/perl-critic.t
DBIx-Custom-0.1674/xt/dbix-connector.t
Geo-Distance-XS-0.09/xt/
FBP-Perl-0.21/xt/pod.t
Getopt-Compact-WithCmd-0.14/xt/01_podspell.t
Dist-Zilla-Plugin-CheckExtraTests-0.004/xt/release/pod-coverage.t
MooseX-GlobRef-0.07/xt/pod_spellrc
Web-Request-0.09/xt/release/pod-syntax.t
Amon2-2.52/eg/Hello/xt/perlcriticrc

My question is about best pactices. 我的问题是关于最好的协议。 What is best? 什么是最好的? To upload xt tests to CPAN, or not to upload? 要将xt测试上传到CPAN,还是不上传? What are the advantages of the decision? 决定有哪些优势?

I'd say that the best practice is to upload. 我会说最好的做法是上传。

The benefit is that it lets people hack and patch your code and still be able to run the full test suite. 好处是它可以让人们破解和修补你的代码,并且仍然可以运行完整的测试套件。 Helps with people writing patches - and hurts nobody. 帮助人们编写补丁 - 并且伤害任何人。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM