Perl Toolchain Summit and PAUSE Permission Management Per Distribution
At the Perl Toolchain Summit 2019 in Marlow/Bisham, I added a feature to manage PAUSE permissions per distribution, which I hope makes it easier for you to grant permissions to other contributors.
This was the fifth year of my PAUSE hacking. I had spent first two years to port PAUSE web interface from mod_perl to Plack to get rid of deprecated tools, and another two years from Plack to Mojolicious for more structure and understandability. PAUSE on Mojolicious was deloyed into production at the 2018 summit (I'm sorry I couldn't report this last year). However, it was still checked out from my mojo_wip branch, and fell back to the old PAUSE on Plack from time to time, e.g. when something weird was found in my branch, or to use new maintenance tools my branch didn't have. One of my goals this year was to resolve this issue.
Stupid Unicode Trick: Noncharacters
Perl RT 133292 is a request to expose the internal perl
subroutine that does string interpolation, so that one does not need to figure out how to double-quote a string (escaping where necessary) when feeding it to eval() as a quick-and-dirty templating system.
In fact, there is no such subroutine (the parser makes an interpolation into a concatenation), and anyway why not just use sprintf()?
For someone determined to dive down this rabbit hole, though, Unicode offers another way out: use generic quotes; that is, qq
, but delimit the string with a noncharacter. This was suggested to me when I saw the Incompatible Changes section of the Perl 5.29.0 perldelta (1). They're making unassigned code points illegal delimiters? They were legal before??? What else is legal that I did not know about????? (2)
How I Spent My Perl Toolchain Summit v2019
I was fortunate to be able to attend the Perl Toolchain Summit again this year. The MetaCPAN team worked hard. I've tried to summarize our efforts with this post.
Reusing data with YAML Anchors, Aliases and Merge Keys
I just added a feature called "Merge Keys" to YAML::PP. No Perl YAML module supports this so far. You can merge mappings defined elsewhere in your YAML document into other mappings with that. Here is a short example:
PAUSE Projects at PTS 2019
Every year at the Perl Toolchain Summit (PTS), there is some work done on PAUSE, but 2019 was a vintage year. In this blog post we'll remind you exactly what PAUSE is and does, and then take you through the major bits of PAUSE work done.
This blog post is brought to you by ZipRecruiter, who were a Gold sponsor for the PTS. More information about ZipRecruiter is provided at the end of this article.
MTA-STA for Exim, thanks to Perl
MTA-STS (RFC8461) is a new standard that makes it possible to send downgrade-resistant email over SMTP. In that sense, it is like an alternative to DANE. It does this by piggybacking on the browser Certificate Authority model.
There is a validator here which defaults to checking gmail.com, and possibly can answer your questions about it without the "tl;dr" factor of the RFC.
This perl script was posted on the Exim mailing list, and is designed to work with the Exim Perl interpreter. On demand, this script will check if MTA-STS data is in a LMDB database. If it is not then it will poll a domain for MTA-STS info and put the info into the database. Then, respond to EXIM with required info for processing the outgoing email.
This script provides reboot resistant caching of MTA-STS data. And if the database is not found, it will reconstruct the database and restart the caching.
Exim is the most popular MTA to if you are running your own mail server this is a good chance you are using it.
The link again: https://github.com/Bobberty/MTASTS-EXIM-PERL
Map::Tube v3.62 - UPDATE
One thing about Map::Tube that kept annoying me for long time, is not able to format the result of search without bending the back. Let me share the details what I am talking about. Earlier, before v3.62, this is what you would had to do to format the result.
use strict; use warnings;
use Map::Tube::London;
my $map = Map::Tube::London->new;
my $route = $map->get_shortest_route('Baker Street', 'Wembley Park');
print $map->to_json($route);
We have a plugin Map::Tube::Plugin::Formatter that provides the functionalities. It currently supports the following formats.
1. XML
2. JSON
3. YAML
4. STRING
If you noticed the line "print $map->to_json($route);", this is plain ugly, in my opinion and I always wanted to clean up. Yesterday, I finally got that done. Now the above code can be simplified as below:
use strict; use warnings;
use Map::Tube::London;
my $map = Map::Tube::London->new;
my $route = $map->get_shortest_route('Baker Street', 'Wembley Park');
print $route->to_json;
Or even one-liner like below:
use strict; use warnings;
use Map::Tube::London;
print Map::Tube::London->new->get_shortest_route('Baker Street', 'Wembley Park')->to_json;
I am sure, there is still scope for improvements but for now, I am happy.
Any suggestions?
Perl Weekly Challenge # 7: Niven Numbers and Word Ladders
These are some answers to the Week 7 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Challenge # 1: Niven Numbers
Print all the niven numbers from 0 to 50 inclusive, each on their own line. A niven number is a non-negative number that is divisible by the sum of its digits.
A Niven number or harshad number is a strictly positive integer that can be evenly divided by the sum of its digits. Note that this property depends on the number base in which the number is expressed (the divisibility property is intrinsic to a pair of numbers, but the sum of digits of a given number depends on the number base in which the number is expressed). Here we will consider only numbers in base 10.
Please also note that 0 cannot be a divisor of a number. Therefore, 0 cannot really be a Niven number. We'll start at 1 to avoid problems.
Niven Numbers in Perl 5
YAML and more at the Perl Toolchain Summit 2019
This year, I was happy to hear I would be invited again to the Perl Toolchain Summit, an annual event with about 30-35 people hacking four days on toolchain related stuff, improving user experience.
This time it was held in Marlow, a small city two hours from London, in an old abbey which was beautiful (but cold!).
Reddit: After 2020, European Perl conferences are over
This popped up on Reddit, I don't go there much either, but the crowd here might want to read get involved in the dicussion:
Quote:Renaming modules from the command line
As we continue to build Tau Station, the free-to-play narrative sci-fi MMORPG (what a mouthful!), we find our code base is getting larger and larger. As with any large codebase, we've found ourselves sometimes mired in technical debt and need a way out.
One simple hack I wrote has saved so much grief with this process. I can run this from the command line:
bin/dev/rename-module.pl Veure::Old::Module::Name Veure::New::Module::Name
And it automatically renames the module for me, updates all references to it, creating directories as needed, renaming test classes built for it, and uses git
.
Daily CPAN upload chain broke, again !!!
Yesterday was the saddest day for me as the daily CPAN upload chain was broken again. It reminded me of the day when it happened last time when I was on 1027 days. It was the first day of my holiday in India. It was easier to cope with the heartbreak that time as I was with my parents. Like always, I had delegated the uploading task to my younger brother, who lives in Pune, India. But for some reason, he forgot to upload the tarball and when he realised it was too late.
Around 12:15pm yesterday I was about to do routine daily upload to CPAN. I immediately got "Internal Server Error" first. I have never ever seen that error before. Not sure what to do, I jumped on Twitter and asked for any advise.
Olaf Alders responded first and suggested to reach out to #toolchain (IRC).
Little later Neil Bowers replied that he contacted Andreas and Perl NOC team by email.
Perl Toolchain Summit 2019 report
The Perl Toolchain Summit (previously known as the Perl QA Hackathon) is an annual coding workshop for people involved in the Perl toolchain, testing, quality assurance, and related issues. I was glad to be invited to this one, my fourth.
Wildcard Unicode Property Values
In addition to Native Variable-Length Lookbehind, Perl 5.29.9 (sic) includes another Regexp enhancement: wildcard Unicode property values. (And yes, this blog post sat around in draft form for over a month.)
Despite its name, the implementation is in terms of regular expressions rather than traditional wildcards. An example may be better than an explanation here: instead of writing /[\p{Script=Latin}\p{Script=Greek}]/
, the new feature allows you to write /\p{Script=<\A(Latin|Greek)\z>}/
. This is, according to perlunicode, a partial implementation of the Unicode Consortium's Wildcards in Property Values. Something like /\p{<Latin|Greek>}/
will not work, nor will /\p{Is_<Latin|Greek>}/
; you must specify property name = ...
to access this functionality.
Note the need for anchors in the above example. Something like /\p{Script=<ee>}/
would match any script whose name contained a double "e".
Perl Weekly Challenge # 6: Ramanujan's Constant
These are some answers to Challenge 2 of the Week 6 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Challenge 1 (compact numeric ranges) was covered in this post.
Challenge 2 was as follows:
Create a script to calculate Ramanujan’s constant with at least 32 digits of precision. Find out more about it here (Wikipedia link).
The Wikipedia link provided in the question concerning this second challenge was apparently changed some time after the challenge was initially posted.
The original link, posted on Monday, April 29, 2019, was pointing to the Landau-Ramanujan Constant, which relates to the sum of two squares theorem.
Then, two days later, on May 1, 2019, I noticed that the link had changed and pointed towards this other Wikipedia page about Ramanujan's constant, which refers to irrational (well, in this case, actually transcendental) numbers that almost look like integers. I do not know when exactly the Wikipedia link was changed.
Monitorix 3.11.0 released
Another great Perl software that I find very useful is Monitorix.
Monitorix is FOSS lightweight system monitoring designed to monitor as many services and system resources as possible.
The tl;dr is that it works really well for monitoring stand alone machines- which is what I used it for. It's tracks all sorts of metrics with minimal configuration by me, and with packages for most distros its trivial to install and update.
Version 3.11.0 was released in March with new features and fixes.
Try it for yourself at Monitorix.org and at Github
Monthly Report - April
Last month was mostly dedicated to the "Perl Weekly Challenge". It took most of my spare time and because of that I had to delay my other pet project "London Hack Day". I promise to get it going soon. The "Perl Weekly Challenge" is now settling down quite well. I have had positive feedback so far. We now have 77 active members. It is also becoming popular on Twitter as we now have 117 followers with over 300+ tweets. It is nice to see how Perl5 and Perl6 communities worked on this project without any issues. If you have time then please take a look at the Knowledge Base.
Let's take a quick look through last month main activities.
- Pull Request
- Git Commits
- Perl Weekly Challenge
- Pull Request Club
- Perl Blog
- PerlWeekly Newsletter
- Adopt CPAN Module
Pull Request
60 Pull Requests submitted in the month of April. With this I have now completed 50+ Pull Request every month so far in the year 2019, one of my new year resolutions.
Overall 1701 Pull Request altogether.
Perl Weekly Challenge 006: Ranges and Ramanujan's Constant
This week, after having read the tasks, I decided to demonstrate the power of CPAN. There already are modules that solve the problems, so the only skill you need is the art of searching CPAN.
Perl Weekly Challenge # 6: Compact Number Ranges
These are some answers to the Week 6 of the Perl Weekly Challenge organized by Mohammad S. Anwar.
Spoiler alert: this post reveals breaking details about the plot of forthcoming episodes of Game of Thrones. Oops, no, that's not what I meant to say. As of this writing, the Perl Weekly Challenge # 6 is still going until Sunday May 10, 2019, please don't read on if you intend to solve the challenge by yourself.
The Wikipedia link provided in the question concerning the second challenge (Ramanujan's Constant) was apparently changed some time after the challenge was initially posted. I worked on the original link (and the Landau-Ramanujan Constant), only to find out a couple of days later that the question is now different. Because of that, I'll hopefully cover the second challenge in a later post (and will try to provide at least partial answers for both constants associated with the name of Srinivasa Ramanujan).
About blogs.perl.org
blogs.perl.org is a common blogging platform for the Perl community. Written in Perl with a graphic design donated by Six Apart, Ltd.