开发者

What is the correct way to stop a Perl module build process?

开发者 https://www.devze.com 2023-02-02 11:01 出处:网络
If a Perl module I create has something like a \"Makefile.PL\" or \"Build.PL\" to build a Perl module, and, for example, the module requires a particular operating system or a particular library to be

If a Perl module I create has something like a "Makefile.PL" or "Build.PL" to build a Perl module, and, for example, the module requires a particular operating system or a particular library to be installed in the system, how should I write "Makefile.PL" so that the build process halts correctly? I'm particularly interested in what method is required by开发者_开发百科 the CPAN testers in order that the module is not given a "fail" result on http://www.cpantesters.org/.


To quote http://wiki.cpantesters.org/wiki/CPANAuthorNotes:

"How can I indicate that my distribution only works on a particular operating system?"

While it isn't a very elegant solution, the recommend approach is to either die in the Makefile.PL or Build.PL (or BAIL_OUT in a test file) with one of the following messages:

No support for OS
OS unsupported

CPAN Testers tools will look for one of those phrases and will send an NA (Not Available) report for that platform.

"How can I stop getting FAIL reports for missing libraries or other non-Perl dependencies?"

If you have some special dependencies and don't want to get CPAN Testers reports if a dependency is not available, just exit from the Makefile.PL or Build.PL normally (with an exit code of 0) before the Makefile or Build file is created.

exit 0 unless some_dependency_is_met();
0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号