Peter Stuifzand

I rewrote my blog software in Perl

In the last few weeks I have rewritten my blog software in Perl. The old version used Ruby. I wrote that version, because I wanted to try out Ruby. The software is about as old as the blog itself.

The new software is written Perl. I use many new modules in Perl. For example Moo, Path::Tiny and Carton.

Moo is an OO library for Perl. It allows me to write OO code in Perl without any boilerplate. One of the nice features of Moo is the lazy setting for the is attribute. This makes the attribute lazy and calls a builder when initializing it.

Path::Tiny is a small abstraction that simplifies all code that works with files and directories. The relative method finds the relative part of the filename in a directory. It becomes trivial to copy a file from one directory to another while keeping the same structure. I use this to copy CSS and JS assets to final output.

Carton gives me control over the modules that are installed. I write a small cpanfile with the dependencies of my program and carton installs those modules.

Not all features of the old software are rewritten, but they’re not really needed.

© 2023 Peter Stuifzand