views:

261

answers:

4

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?

+15  A: 

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.

friedo
+9  A: 

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

Tim Henigan
I'd even start with `perldoc perlnewmod`, which will eventually point you to `perlmod` and `perlmodlib`.
mobrule
+5  A: 

See José's Guide for creating modules.

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

brian d foy
'Writing Perl Modules for CPAN' is no longer available as a free download, I got an email confirming that (and a coupon) when I wrote them to mention that the 'Free Ebook Download' on that page returns a blank page. They never fixed the page though.
MkV
Well, that sucks. I'm not sure it was worth your downvote for something that I said almost a year ago and is easy to fix now.
brian d foy
+5  A: 
  • 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.

a paid nerd
Love your avatar.
friedo
Thanks! Finally someone gets it. :)
a paid nerd
A better choice for discussion of Perl is #perl++ on irc.perl.org, or #perl on irc.freenode.net.
Andy Lester
@Andy: no way, #perl on irc.perl.org still r0xors. :) There's also #distzilla and #toolchain which are useful for getting help with creating modules.
Ether
@Ether: #perl on irc.perl.org specifically says it is not a help channel, and shoos away the inquisitive in its /topic.
Andy Lester
@Andy: pay no attention to the /topic. :) That's just to thin out the timid. :)
Ether
@Ether: That's hardly encouraging.
Andy Lester