Quickly create framework for a new Perl module

If you're about to write a new Perl module (perhaps something you plan on releasing to CPAN) a good way to build an initial “framework” is to run:

h2xs -AXc -n NewModule

That will create a new directory named NewModule, and add the appropriate files in it, leaving you with templates to edit to start developing your module.

Running it should give results similar to the following:

[~/modules],2:05pm% h2xs -AXc -n NewModule
Writing NewModule/NewModule.pm
Writing NewModule/Makefile.PL
Writing NewModule/test.pl
Writing NewModule/Changes
Writing NewModule/MANIFEST
[~/modules],2:05pm% cd NewModule/
[~/modules/NewModule],2:05pm% ls
Changes        MANIFEST       Makefile.PL    NewModule.pm   test.pl

Now, edit the files as appropriate, and start building your module!

Packaging modules for release

When you're happy with your module, you can use make dist to package it up into a convenient tarball to upload to CPAN or give to your friends.

 
perl/creatingmodules.txt · Last modified: 2010/02/26 10:45 (external edit)
 
Recent changes RSS feed Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki