Raku++ module manager

This latest Raku++ release v4.0.0 is called Raku that travels. That suggests that you can take Raku with you and use it beyond the Raku bubble.

One of the goals of the release was to ensure that at least 1000 modules from the Raku ecosystem works with Raku++. And that goal was achieved: a bit more than 1000 modules from about 2500 distributions now pass their own suite tests.

Installing modules

Raku++ module manager is now fully embedded in the main rakupp binary. (You no longer need to take the tools/install.raku program with you.)

Installing, upgrading and removing modules with Raku++ is easy:

$ rakupp install Config::INI
$ rakupp reinstall Config::INI
$ rakupp uninstall Config::INI

You can also test the module before really installing it, as well as you can skip the tests and install:

$ rakupp test Config::INI
$ rakupp install --no-test Config::INI

This process is fully compatible with using zef. Either installation (zef install Config::INI and rakupp install Config::INI) works with both Rakudo and Raku++:

$ rakupp install Config::INI

$ rakupp -MConfig::INI -e'Config::INI::parse("[server]\nlang=raku\n").say'
{server => {lang => raku}}

$ rakudo -MConfig::INI -e'Config::INI::parse("[server]\nlang=raku\n").say'
{server => {lang => raku}}

Embedding modules

A program compiled to a binary file embeds the modules it needs, so you don’t have to take extra files with you. (From this moment, let me use a symlink that I made for myself already: raku points to rakupp, Rakudo stays rakudo).

$ raku --exe -o ini ini.raku 
--exe: embedded 1 module: Config::INI
Compiled (native) ini.raku -> ini

$ raku uninstall Config::INI
uninstalled Config::INI:ver<1.2>:auth

$ ./ini 
server.host => 'example.com'
server.port => '443'

So the program keeps working even if the module is explicitly uninstalled.

Just for the full picture, here’s the program itself:

use Config::INI;

my %conf = Config::INI::parse("my.ini".IO.slurp);

for %conf.keys.sort -> $section {
    for %conf{$section}.keys.sort -> $key {
        say "$section.$key => '%conf{$section}{$key}'";
    }
}

And the test INI file:

[server]
host=example.com
port=443

Leave a Reply

Your email address will not be published. Required fields are marked *

Retype the CAPTCHA code from the image
Change the CAPTCHA codeSpeak the CAPTCHA code