Work report, week 7.
Tags: opensource, perl6, gsoc
Published: 2019-07-15 14:39:27

---
title: Work report, week 7. 
published: true
description: Work report, week 7.
tags: #opensource #perl6 #gsoc
series: GSoC 2019
cover_image: https://thepracticaldev.s3.amazonaws.com/i/efz8oj2vdq41j61djv17.png
---

### New feautres 

Here I am another week! This week I have improving a lot of aspects of [Perl6::Documentable][1]:

- Now it has a very useful `update` option to only regenerate the HTML documents coming from pod6 files that have been actually modified. This is a characteristic in the [documentation's wishlist][2]. Before this feature, if you wanted to see a change in the HTML you had to regenerate everything, what takes 2:30' approximately, plus processing the pod collection again. Now, with the cache and update option, it only takes around 10 seconds to see a change (and half of that time is spent is reprocessing the collection).

- I have also made some little refactoring to distribute the responsibilities in a better way. In addition, you will find a new `setup` option. The aim of this feature is to initialize the directory where the documentation will be generated. What needs to be setup? Nothing, really, but if you want your freshly generated documentation to have an style sheet, search capabilities, etc., you need to download the necessary files or provide ones yourself.

- Some minor bug fixes like: [leading whitespaces files](https://github.com/antoniogamiz/Perl6-Documentable/issues/43) or the [correct detection of subkinds](https://github.com/antoniogamiz/Perl6-Documentable/issues/34).

- CI testing! This is an important change because I made a terrible mistake! I did not test if the module actually could be installed, and it could not! Thanks to @ugexe for noticing this and tell me. I do not know if you remember [Perl6::LinkHealth][3] and the [mini-doc repository][4], but they have also been integrated in this CI testing so now almost everything is covered :D.

And that's all the work I have made this week, if you want me to introduce whatever new feature you find interesting or useful, just tell me!

## Next steps

Mmm, what should I do next? [Perl6::Documentable][1] is in a good state right now, so I will continue fixing bugs and make general improvements.

Nonetheless, I also want to start the work with [Pod::To::HTML][6] and [Pod::To::BigPage][5]. What needs to be done? Well, currently indexing is made in three different ways so it would be nice if we unify them into one. Moreover, the last two modules use different ways to convert a pod file into html, so it does not make a lot of sense to have duplicated logic. I may even create only one module joining both functionalities. I still do not know, I still have to discuss this with my mentors!

## Perl6 curiosity

I have been thinking these weeks that write an article telling what I have done in a specific week is not that funny, so I will tell you about some characteristic of Perl6 that I have found useful and interesting.

Today: CLI! This week, I have had to add different options to the CLI version of [Perl6::Documentable][1], and I thought this would be a little tedious, but I could not be more mistaken! As always, Perl6 makes your life easier and provides you with a very simple way of doing it. 

Suppose you want to create your own CLI program, for instance, one that reproduces the `zef` command. First you should create a new file containing that functionality, let's call it `Perl6::Zef`. Now you need to create a new file where you will read the arguments the user has specified, `Perl6::Zef::CLI`.

This new file would be something like this:

{% gist https://gist.github.com/antoniogamiz/6d4d8a7f8537b7a5e43de8bfc4531914 %}

Oh, what a weird code!. It really is not that weird, we only define "the skeleton" of the `MAIN` function (this function is called every time a file is executed) because it will have several different definitions.

After that, we simply specify two definitions of `MAIN`, but wait, you have written `install` and `update` as arguments, is that correct? YEP, in Perl6 this compiles and works. This is an amazing feature because it gives you the possibility to deal with the cases you need in an easy way.

I have also written `#|` and `#=`. These two are called _declarator blocks_. What does this kind of comment? The comment you write after that is attached to the source code below it. Why this is useful? Because, for instance, with those comments, you do not need to specify a `--help` option or something alike, because if you try to use this module with incorrect arguments, `perl6` will tell you this:

~~~
$ > perl6 zef.pm6

Usage:
  zef.pm6 [--name=<install>] -- Install a new package
  zef.pm6 [--name=<update>] -- Updates a package
  
    --name=<install>    Name of the package to install
    --name=<update>     Name of the package to update

~~~

![simply perl6](https://i.pinimg.com/originals/7b/4f/6a/7b4f6a993a37feba36efd20910d03920.jpg)

I know, quite handy, isn't it? :D.

Summing up, I hope you try give a change to Perl6 because it has a lot of incredible characteristics!

See you next Monday :DDD.

[1]: https://github.com/antoniogamiz/Perl6-Documentable
[2]: https://github.com/perl6/doc/issues/2668
[3]: https://github.com/antoniogamiz/Perl6-LinkHealth
[4]: https://github.com/antoniogamiz/mini-doc
[5]: https://github.com/perl6/perl6-pod-to-bigpage
[6]: https://github.com/perl6/Pod-To-HTML