How to Start a Perl 6 module project


If you would like to start or work on Perl 6 module project, it's fairly easy to do so. It is common practise to store the source code on github, but of course you can chose your own version control system, or even use the pugs repository.

Preparations

Compile Rakudo, install it, and make sure the perl6 binary is in your PATH environment variable

You can get depdendent modules from http://modules.perl6.org/.

It is highly recommened to install ufo from http://github.com/masak/ufo/ and put the 'ufo' executable file into PATH too

Directory Layout

Like in Perl 5 modules, the actual modules are typically stored in lib/, with .pm6 or .pm extension. Tests are usually in t/somewhere.t.

For development it is often convenient to include lib/ in the module loading path: export PERL6LIB=lib/.

Building and running tests

Since most modules consists of .pm or .pm6 files that can be pre-compiled to PIR in a pretty simple way, it is possible to auto-generate the Makefile for you by running the ufo command.

$ ufo
$ make # precompiles
$ make test # runs all t/*.t files, precompiles if necessary
$ make install # installs into ~/.perl6/lib/