April 2022 Archives

Perl Advent Calendar articles about Moose

At $work, one of my colleagues who is not in a developer role has started to get into writing code more and more, and I am mentoring him. He's about to work on a productive ticket with Moose for the first time, so I gave him a little reading list, mostly involving selected parts of the documentation as well as Ricardo Signes' excellent talk Moose is Perl.

But then I thought I must have read lots of great blog posts about Moose on the Perl Advent Calendar over the years. I tried to find a few, but had some trouble identifying them easily. So I wrote a quick scraper. Here are all articles that mention Moose since 2010 (where the format of the website changed). Most of them are about Moose or one of the numerous MooseX modules.

And if you'd like to find your own list of articles for another module, here's the code I used.

use strict;
use warnings;
use open qw/ :std :utf8 /;
use Mojo::UserAgent;

my $ua = Mojo::UserAgent->new;

foreach my $year (2011 .. 2020) {
  foreach my $day (1 .. 25) {

    my $url = sprintf 'https://perladvent.org/%s/%s-12-%02d.html',
      $year, $year, $day;
    my $res = $ua->get($url)->result;
    next unless $res->is_success;

    my $dom = $res->dom;
    next unless $dom->all_text =~ m/Moose/;

    my $title = $dom->at('h1.title')->text;
    (my $author) = $dom->at('div#author')
      ->text =~ m/:\s+(.+)\s+[(<]/;

    printf "- %d-12-%02d: [%s](%s) by %s\n", 
      $year, $day, $title, $url, $author;

I would also like to take this opportunity to thank Mark Fowler for running the Perl Advent Calendar since the year 2000. He has managed to convince people to blog for this project almost every year, and it is an invaluable resource. I had the pleasure of meeting Mark at the Perl Conference in Glasgow a few years back, where he gave a talk about the project, and also encouraged people to contribute articles. Last year there sadly was no advent calendar. I think as a community we should come together and help Mark to make this happen again this year. I will offer to write an article, and I encourage all of you (well, at least 24 others) to do this as well!

About simbabque

user-pic I turn people into Perl Developers.