You have just read a blog post written by Jason McIntosh. If you enjoyed it, please anonymously acknowledge your visit by tapping the little star button underneath it.
Thank you kindly for your time and attention today.
I read and enjoyed brian d foy’s Mojolicious Web Clients, a short and direct guide to writing command-line utilities using the open-source, Perl-based web toolkit called Mojo. (The title’s “Mojolicious” formally refers to a full-featured web framework built on Mojo, but I am told that the longer name now embraces both the toolkit and the framework, per the project’s official website.)
I’ve worked with Mojo for a couple of years now; my Webmention library relies upon its wonderful DOM parser, for example. But I didn’t really understand the project as a whole; while it does offer higher-level guides to complement its voluminous nuts-and-bolts reference material, it has always lacked the slower, fleshier explanatory power of a real book. As such, I hungrily purchased foy’s new e-book the moment I learned about it. Even though it covers just one aspect of Mojolicious — using its toolkit to request and extract interesting data from the web, whether via JSON-based APIs or human-intended HTML pages — it still provides very welcome long-form documentation coverage to a project that has long deserved it. I hope similar books follow.
Prior to reading this book, I felt quite foggy on the difference between the Mojo toolkit and the Mojolicious framework, vaguely understanding the latter as a followup to the venerable Catalyst framework, and knowing that CPAN hosted a variety of modules under the “Mojo” namespace but not seeing any particular pattern to them. Happily, foy’s book opens with a history of Perl-based web tools right up through the present, clearly explaining how Mojo has picked up the torch from the long-lived LWP library, and going on to demonstrate its commitment to modernization through an emphasis on fluid coding style and strategic wheel-reinvention.
Mojo, apparently, is one of those rare software projects that starts over from scratch and gets it right. According to its manual page, Mojolicious has only four library dependencies, and all of them already ship with Perl. A veteran Perl hacker recognizes this as absurd, especially for such a wide-ranging project. It often seems that a typical Perl-based project (any of mine included, certainly) wants to download half of CPAN before it will deign to try installing itself, and so Mojo represents a stunning lesson in dependency-austerity. And as such, of course, it brings both a gift and a challenge: use Mojo in your project, and see how little else you’ll need to get to your goal. You just might write better software for it, with far fewer dependencies outside of your control.
To a Perl fan like me, learning Mojo today feels like both a relief and a necessity. At a time when the lights threaten to shut off over Perl’s role as anything other than small-scale Unix-glue, Mojolicious represents a rare project keeping the party going with inventive and ongoing vitality. I was intrigued when colleagues first suggested the Mojo modules to me two years ago, delighted to find Mojolicious quietly starring in Emily Shea’s 2019 conference presentation about voice-driven programming, and now cheered by the arrival of even one fresh book on the topic. As Brian Wisti recently said, “Mojolicious is why I still have Perl installed in 2020”. I like Perl enough and respect its community, however small these days, that I feel obliged to adapt my own practices to better feed from — and, I hope, feed back into — this valuable source of forward-looking energy.
This article was also posted to the “books” section of Indieweb.xyz.
If a page elsewhere on the web responds to or otherwise mentions this post, you may provide its URL here.