How do I get started writing a module for CPAN?

2019-01-21 11:15发布

Right now, I have my own homegrown testing harness/directory structure/support doc strucure/distribution tools for my libraries. However, reading the blog post Write your code like it's going on CPAN, it sounded like a good idea. Then it occurred to me, I'm really not sure how to do that.

What are some good resources to get started making your own Perl packages in the CPAN-like structure?

4条回答
干净又极端
2楼-- · 2019-01-21 11:51
  • 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.

查看更多
Emotional °昔
3楼-- · 2019-01-21 11:53
做个烂人
4楼-- · 2019-01-21 11:58

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.

查看更多
可以哭但决不认输i
5楼-- · 2019-01-21 12:03

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".

查看更多
登录 后发表回答