开发者

How do I get started writing a module for CPAN?

开发者 https://www.devze.com 2022-12-11 04:25 出处:网络
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,

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 t开发者_如何学运维hat.

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


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:

  • perldoc perlmod
  • perldoc perlmodlib

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.

0

精彩评论

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

关注公众号