Looking back to 2018, what I learnt from XS and Dist::Zilla
Nicolas Rochelemagne was in town this month and presented some of the lessons he learned last year. He also gave some context, by covering some best of 2018 topics.
Nicolas started by talking about the Travis CI server.
He has been using it to run tests on multiple Perl versions to verify modules he is working on.
Travis is driven by a configuration in the file
.travis.yml in a module's repository.
In this configuration, you can exclude branches while you work on them, and only build the main branches.
You can also set environment variables to drive particular behavior in the test.
One powerful feature that Nicolas made use of was specifying the Perl versions he wanted to test.
This allowed him to ensure that the modules under test continued to work on older Perls.
There is also an ability to run a script for the build, which allows you to use arbitrary functionality for your test.
He did run into a problem with
It has a large dependency list that was installed for each test.
Rather continue to running the tests incredibly slowly, he modified the
dist.ini file to keep the
Makefile.PL file around.
That required copying the file out of the build directory after a build, and to commit that file as part of the change.
It also meant that using the module did not require the use of
dzil, you could install as a regular Perl module.
This took the builds from 4 minutes per Perl version down to 30 seconds per.
Nicolas talked about 3
Dist::Zilla features that people may not be aware of.
Causes DistZilla to extract the
READMEfile from POD in modules.
- Extract the synopsis code from the POD docs and execute it.
- Copies example code from a specified file into the POD docs.
Best of 2018
Nicolas went over the NICEPERL list of modules chosen as the best of 2018.
Mojolicious::Plugin::JSONAPI- Generates Rails-like routes.
Data::Password::zxcvbn- Dropbox's password strength estimator
CPAN::Audit- audits for known vulnerabilities (kritika.io)
Variable::Declaration- Declare with type constraints
Mojolicious::Plugin::Status- Get a status UI for your servers
Firefox::Marionette- Automate Firefox using the Marionette protocol
Some of the most voted distributions of the year:
Nicolas showed a few XS tricks from some of the code he has been working on lately.
newCONSTSUB(stash, "NAME", value);
- to define a constant
gv_stashpvn(Module, modulename_len, TRUE)
- retrieve a pointer to a stash for a module
BOOT:section is run at load time
- You can create aliases for a C function created with XS
- Each alias has its own index, so you can tell which Perl name called the XS code
- The index is available through the ix variable
If you are going to work in XS, make certain that you are very familiar with C macros.
We had 6 people attending this month. As always, we'd like to thank cPanel, L.L.C. for providing the meeting space and food for the group.