The definitive book, even though it's a few years old, is Sam Tregar's Writing Perl Modules For CPAN. It's available for free download at http://apress.com/book/free.
Module::Starter and its command-line tool module-starter creates the basic framework for a module distribution suitable for putting on the CPAN. It includes basic code layout, POD directives and documentation skeleton, basic tests, the Makefile.PL and MANIFEST files, and the start of README and Changes logs.
$ module-starter --module=Magic::Foo --module=Magic::Foo::Internals \ --author="Andy Lester" --email="email@example.com" --verbose Created Magic-Foo Created Magic-Foo/lib/Magic Created Magic-Foo/lib/Magic/Foo.pm Created Magic-Foo/lib/Magic/Foo Created Magic-Foo/lib/Magic/Foo/Internals.pm Created Magic-Foo/t Created Magic-Foo/t/pod-coverage.t Created Magic-Foo/t/pod.t Created Magic-Foo/t/boilerplate.t Created Magic-Foo/t/00-load.t Created Magic-Foo/.cvsignore Created Magic-Foo/Makefile.PL Created Magic-Foo/Changes Created Magic-Foo/README Created Magic-Foo/MANIFEST Created starter directories and files
If you're creating an XS module, where you're interfacing Perl code with external C code, you'll need to use the original module-starting tool, h2xs. h2xs is included with every Perl distribution, and many was originally grown into a generic module starter, but it's not nearly as up-to-date in what it does as Module::Starter. Unless you need XS code, stick with Module::Starter.
Submit a PR to github.com/petdance/perl101
This work is licensed under a Creative Commons Attribution-ShareAlike 4.0 International License.