Perl 6, Programming/Coding

Building Perl 6 Module

DISCLAIMER: This is just my ‘diary’ or ‘journal’ for daily routines I do in my development process. Please go to for a much better and cleaner steps to build Perl 6 modules.

Building modules can be a bit hacky in Perl 6 environment. However, let’s made things easy by using tools for building modules that has been made by other Perl 6 developers/authors.

Make sure git is installed in your system.

Using Rakudo implementation. Perl 6.c version.

Diving in

Today we gonna use mi6 as the build tool.

So let’s start by downloading the tool.

zef install App::Mi6

Now, whenever your App::Mi6 installation finished successfully, proceed to ‘init’ and build the module skeleton.

For this post, let’s use $HOME or ~/ directory.

Build module skeleton based on your module name, eg Acme::HelloWorld

The Acme-HelloWorld will be automatically setup as a git repository.

Make sure you configured you git config –global user.* first!

mi6 new Acme::HelloWorld

Above will create a new directory called, Acme-HelloWorld

Now cd into ~/Acme-HelloWorld

Bob is building…

Now, we gonna edit the META6.json

"authors" : [
"John Smith"
"build-depends" : [ ],
"depends" : [ ],
"description" : "blah blah blah",
"name" : "Acme::HelloWorld",
"perl" : "6.c",
"provides" : {
"Acme::HelloWorld" : "lib/Acme/HelloWorld.pm6"
"resources" : [ ],
"source-url" : "",
"test-depends" : [ ],
"version" : "*"

change above to

"authors" : [
"build-depends" : [ ],
"depends" : [ ],
"description" : "This prints "hello camelriders"",
"name" : "Acme::HelloWorld",
"perl" : "6.c",
"provides" : {
"Acme::HelloWorld" : "lib/Acme/HelloWorld.pm6"
"resources" : [ ],
"source-url" : "git://",
"test-depends" : [
"version" : "0.0.1"

Explanation to above

  1. “authors” is the authors of the module, eg “faraco”.
  2. “build-depends” is the dependencies needed to build to module.
  3. “depends” is the runtime dependencies for the module.
  4. “description” is your module subscription.
  5. “name” is your module name.
  6. “perl” is where you put the target implementation for the module to be installed.
  7. “provides” is your modules that came with the distribution. Can have more than one file.
  8. “source” is where  extra files that will get installed along with your
    module that you can access via a special variable.
  9. “test-depends” is where testing dependencies is needed, for example, Test::META for checking META6.json or legacy
  10. “version” is your module version

You can skip the subroutine and testing part, and continue to distributing ‘blank’ or ’empty’ module, but I highly recommending you to do all of the parts in this post.

Adding a subroutine into lib/Acme/HelloWorld.pm6

module Acme::HelloWorld<0.0.1>
    sub sayHello {
        say "Hello, camelriders!";

Making tests.

Create a test file called 00_meta.t in t/ and edit the content

use Test;
use Test::META;
plan 1;



and a test file called 01_use.t in t/ and edit the content

use Test;
use Acme::HelloWorld;
plan 1;

is sayHello, 'Hi, camelriders!', 'Passed';


Let’s test

Using zef: zef test .


using prove: mi6 test or PERL6LIB=lib prove -v -r –exec=perl6 t/

(Highly Recommended)

Activating integration
mi6 tool automatically build .travis.yml inside your ~/Acme-HelloWorld.

It is recommended to activate the repository in for automated testing whenever a new version of your module uploaded to your repository.


  1. Create a repository on github named, Acme-HelloWorld.
  2. Add and commit your edits first: git add . ; git commit -m “v0.0.1”
  3. Add your git remote origin, eg git remote add origin
  4. Go to and edit the file by adding your META6.json (raw) link, eg
  5. Submit the file as a pull request and let’s drink a cup of coffee while waiting for our pull request to be merged into the repository.

Let’s wait your distribution to be indexed in (usually one to two hours) after your pull request are merged.

Installing your module and testing
zef update && zef install Acme::HelloWorld

open ‘perl6’ interpreter and enter

use Acme::HelloWorld;

sayHello; # => “Hello, camelriders!”


It looks so hacky and tedious to make and distribute the module from my article post. It is not actually, and please visit before you use this post as your primary reference to build the module.


Well, this is end for this article. I hope this post benefits you and aid you in journey in using Perl 6. ~~ faraco roger and out.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s