Here I am another week! This week I have improving a lot of aspects of Perl6::Documentable:
Now it has a very useful
updateoption to only regenerate the HTML documents coming from pod6 files that have been actually modified. This is a characteristic in the documentation's wishlist. 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
setupoption. 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.
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 and the mini-doc repository, 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!
Mmm, what should I do next? Perl6::Documentable 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 and Pod::To::BigPage. 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!
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, 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,
This new file would be something like this:
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
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
#=. 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
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.