A hastily-assembled review of Perl advent calendars for 2019
Work greatly interfered with this, so I'm afraid this presentation is a bit less polished than I would like. My apologies.
Overview
There was another semi-Perl-related advent calendar as well:
Perl Advent Calendar
The Perl 5 Advent Calendar, erst managed by Jerrad Pierce, this year again run by Mark Fowler.
My highlights
- Day 7: Show Me Mo'; the Mo module
- Day 12: Now With Added Interactivity; GUIDeFATE
- Day 18: Core Strength; Module::CoreList Module dependency graphs
- Day 21: Test2: Test Harder (but easier); Test2::V0
Mo
Last year, the Advent calendar discussed Mu, which is a shortcut for importing Moo and MooX::ShortHas.
This year, in the line of “Moose still hasn't taken over the world”, it offers Mo. Mo is part of the great continuum of Moose modules: M, Mo, Moo, Moos, and of course Moose (see also MooseX and MooseY).
Mo gives you very basic new
, extends
, and has
keywords. It has some optional features provided by helper modules.
One nice thing is that you can use Mo::Inline to create a custom base module with your own combination of features.
In the design documents, there is a fun line: “Mo.pm and its feature modules are golfed, compressed and unreadable by mere mortals.”
Another cool bit of code is in the article at the bottom, where you can inline Mo into any file.
GUIDeFATE
Day 12: Now With Added Interactivity
“GUIDeFATE” is short for “GUI Design From A Text Editor”.
The idea is that you can easily create a (basic) GUI by describing the interface using ASCII-style art.
Module dependency graphs
Day 18 is interesting to me not as much for the module highlighted (Module::CoreList), but for the link to the module dependency graphs.
For instance:
Hours* of fun!
* well, minutes of fun at least…
Test2::V0
Day 21: Test2: Test Harder (but easier)
I intend to prepare an entire talk about this, but I find Test2 to be a useful upgrade on the more classic Test:: modules.
I've written a fairly large test suite using Test2, so here are some files we can look around…
- Countries.t (Countries.pm)
- EnvObject.t (EnvObject.pm)
- Logger/log.t (Logger.pm)
- POCatalog.t (POCatalog.pm)
- Rotator.t (Rotator.pm)
- Rules/new.t (Rules.pm)
- Translator.t (Translator.pm)
There is some interesting documentation, some YouTube videos of talks about the Test2 suite from 2017, 2018, and 2019. Also, there is documentation and a video about yath
.
Mini-themes
There were several thematic groupings in the Advent calendar this year:
- Passwords and authentication:
- Day 1: J1ngle? No...zxcvbn; Data::Password::zxcvbn
- Day 2: Have Elf Been Pwned?; WebService::HIBP
- Day 3: Two Factor Elfication; Authen::OATH
- Better interfaces:
- Amazon AWS:
- Day 15: Suddenly Serverless; AWS::Lambda::Quick
- Day 16: Paws to Plan What Todo; Paws
- Day 17: Taking the Sleigh to a CloudFront
- (Day 18, presented as useful with regard to AWS: Core Strength; Module::CoreList Module dependency graphs)
- Test2:
- Day 21: Test2: Test Harder (but easier); Test2::V0
- Day 22: Comparing More
- Day 23: Testing our Impatience; yath
- Image creation:
- Day 14: Animated GIFs; GD
- Day 24: We Wish You a Meme Christmas; Imager
- Integration and tools:
- Day 4: Going for Perl; FFI::Platypus
- Day 5: Christmas Lights
- Day 6: The Weather Outside Is Frightful; DarkSky API DarkSky::API
- Day 20: Controlling your Terminal with Perl; iTerm 2
Everything
Day | Topic |
---|---|
1 |
J1ngle? No...zxcvbn; Data::Password::zxcvbn Rate the strength of passwords. |
2 |
Have Elf Been Pwned?; ';--have i been pwned? WebService::HIBP Avoid reusing passwords. |
3 |
Two Factor Elfication; Authen::OATH Easy two factor authentication. |
4 |
Talk with libraries from other languages. |
5 |
Using Perl to communicate with Phillips Hue Home Bridge. |
6 |
The Weather Outside Is Frightful; DarkSky API DarkSky::API Using Perl to query a weather forecaster. |
7 |
Object syntax sugar, but less. |
8 |
Mojo::UserAgent, PerlIO::gzip, DBD::SQLite, etc. |
9 |
Command Line Browser Apps; Net::EmptyPort Browser::Open Show information in a web browser from a command-line application. |
10 |
Awaiting Christmas; Mojo::AsyncAwait Asynchronous stuff in Perl. |
11 |
Now With Added Interactivity; Mojo::Transaction::Websocket QuickBrowserGUI A followup on the command-line browser applications, with added interactivity. |
12 |
Now With Added Interactivity; GUIDeFATE Further experiments in easy GUI creation. |
13 |
Setting up a utility web server. |
14 |
Making animated GIFs in Perl. |
15 |
Suddenly Serverless; AWS::Lambda::Quick Quickly set up an AWS instance. |
16 |
More AWS stuff. |
17 |
Taking the Sleigh to a CloudFront Using Mojolicious on AWS servers. |
18 |
Core Strength; Module::CoreList Module dependency graphs Find out which modules are a part of Perl core. |
19 |
Memories of Past Lives; Memoize Memoize::Expire Memoize data to disk; also expire memoized data. |
20 |
Controlling your Terminal with Perl; iTerm 2 Some configuration suggestions for iTerm 2. |
21 |
Test2: Test Harder (but easier); Test2::V0 Better testing. |
22 |
Writing custom comparators for Test2. |
23 |
A newer test harness for use with Test2. |
24 |
We Wish You a Meme Christmas; Imager Making memes with Perl. |
25 |
Trust me on enjoying Christmas. See the original column (linked to from the article), but also the YouTube video. |
Raku Advent Calendar
My highlights
- Day 4: Not tripping over tripcodes
- Day 10: A Teaser
- Day 19: Functional Programming with Raku
- Day 24: The Grinch of Raku, Part 2: Hold Your Horses
Creating tripcodes in Raku
Day 4: Not tripping over tripcodes
A tripcode (also here) is a hashed password, constructed in a particular way, which comes to us from the anonymous imageboards (4chan, 8chan, etc.).
I like this because it does a complex string transform, but explains the various parts well. It also shows some nice features of Raku.
A quick optimization tip
The article is an extract from an upcoming book (“Migrating Perl to Raku”). This particular snippet discusses a surprising fact; to wit, accessing object accessors is faster than accessing hash keys in Raku.
It also shows a particular idiom from Raku for determining how quickly something is executing:
say now - INIT now;
Functional Programming
Day 19: Functional Programming with Raku
In response to a video (Functional Programming in 40 Minutes), the author explores the three “core concepts” of functional programming in Raku:
“Rakuf*ck”
Day 24: The Grinch of Raku, Part 2: Hold Your Horses
There is a tool called JSF*ck, which is similar in spirit to Acme::Bleach (and of course Brainf*ck), and which uses some features of Javascript to implement any program using just six characters ([
,]
,(
,)
,!
,+
).
This article walks through translating the JSF*ck idiom to the Raku language, creating something similar. The list of used characters is not quite as compact, but it's still perfectly unreadable.
Everything
Day | Topic |
---|---|
1 |
Raku from Perl: Transforming Old Perl Code Porting a program from Perl 5 to Perl 6, using Inline::Perl5 |
2 |
CRUD with Cro::HTTP, a tutorial Creating a CRUD web service with Cro. |
3 |
Reducing stack frames with trampolines. |
4 |
Creating “tripcodes” with Raku. |
5 |
Modular Raku Command Line Apps Moving code into modules. |
6 |
Put some (GitHub) Actions in your Raku (repositories) Using Raku in GitHub actions. |
7 |
Parsing Firefox’ user.js with Raku A grammar to parse user_pref calls. |
8 |
Parsing Firefox’ user.js with Raku (Part 2) Expanding the previous day's grammar. |
9 |
A chain (or Russian doll) of containers Setting up Raku containers. |
10 |
A part of a chapter from the upcoming book “Migrating Perl to Raku”. |
11 |
The Libarchive library. |
12 |
IRC bots. |
13 |
Rust, Raku, FFI. |
14 |
Thinking Beyond Types: an Introduction to Rakudo's MOP An introduction to Rakudo's MOP. |
15 |
Fuzzy matching in grammars. |
16 |
Raku powered jmp-ing to the coalface A followup on jmp from last year's advent calendar. |
17 |
A port of a maze-making algorithm to Raku. |
18 |
What is my concurrent or parallel Raku program doing?; Log::Timeline A module to create a timeline from log entries. |
19 |
Functional Programming with Raku An overview of functional programming requirements in Raku. |
20 |
Raku from Perl: Transforming Old Perl Code (Part 2) Continuing from day 1. |
21 |
A Perl 6 ORM, although still in development. Probably working this time. |
22 |
Some books are coming out. |
23 |
A Raku Advent Helper; RakuAdvent::WordPress A helper module for posting Raku Advent Calendar posts. |
24 |
The Grinch of Raku, Part 2: Hold Your Horses JSF*ck in Raku. |
25 |
C'est finis. |