How do I get started writing a module for CPAN?

吃可爱长大的小学妹 提交于 2019-11-28 17:04:24

I usually start with Module::Starter. It comes with a pretty simple command-line tool that will create a new distribution from a template, including all the necessary files and a t/ directory, and so on. It will also produce either a Makefile.PL (using ExtUtils::MakeMaker) or a Build.PL (using Module::Build.)

It also places an empty .pm file there with templates in place for your POD and such.

The best place to start is the CPAN FAQ.

As noted there, the following are good resources:

As always, the PerlMonks are a good resource as well. See their "How to make a CPAN Module Distribution".

  • Ricardo Signes is a pretty prolific module author, and he often writes tools to make module creating as easy as possible. His modules are usually pretty up to date and he seems to stick with the most modern approaches to creating a CPAN distribution, so his distributions are probably good examples. He seems to use Dist::Zilla for managing and uploading his distributions.

  • Check out Module::Starter module which generates useful boilerplate to help with the creation of a modern Perl module.

  • Write tests! Check out the Perl Quality Assurance Projects page. It's a bit outdated, but it has some great links to quality reading material.

  • Check out CPANTS, the CPAN Testing Service

  • After you've read up on the best tools to create modules, get an account on PAUSE, which allows you to manage your distributions on the CPAN.

  • Join the #perl IRC chat channel on irc.perl.org. Only about half of the discussion is actually about Perl, but a lot of module authors hang out there and you can learn a lot.

See José's Guide for creating modules.

You might also like Sam Tregar's Writing Perl Modules for CPAN.

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!