I think this is the real point about Perl code readability: it gives you enough flexibility to do things however you like, and as a result many programmers are faced with a mirror that reflects their own bad practices back at them.
This is why Damian Conway’s Perl Best Practices (2005) is one of my favorite books and
perlcritic, the code analyzer is one of my favorite tools. (Though the former could do with an update and the latter includes…
I publish Perl stories on this blog once a week, and it seems every time there’s at least one response on social media that amounts to, I hate Perl because of its weird syntax.” Or, ”It looks like line noise.” (Perl seems to have outlasted that one — when’s the last time you used an acoustic modem?) Or the quote attributed to Keith Bostic: ”The only language that looks the same before and after RSA encryption.”
So let’s address, confront, and demystify this hate. What are these objectionable syntactical, noisy, possibly encrypted bits? And why does Perl have them?
override keyword in Perl’s Moose object system is a nice bit of code-as-documentation since it explicitly states that a given method overrides from its superclass. It also has a
super keyword that can be used inside an
override, calling “the next most appropriate superclass method with the same arguments as the original method.”
The Moose documentation then goes on to say, “The same thing can be accomplished with a normal method call and the
SUPER:: pseudo-package; it is really your choice.” So when should you use one and not the other? I decided to find out.
First I defined…
In March I wrote The Perl debugger can be your superpower, introducing the step debugger as a better way to debug your Perl code rather than littering your source with temporary
Although I mentioned a caveat when debugging web applications, our apps at work all adhere to the Perl Web Server Gateway Interface ( PSGI) specification and thus we can use tools like Test::WWW::Mechanize::PSGI or Plack::Test to run tests and debugging sessions in the same Perl process. …
We have a huge codebase of over 700,000 lines of Perl spread across a couple dozen Git repositories at work. Sometimes refactoring is easy if the classes and methods involved are confined to one of those repos, but last week we wanted to rename a method that was potentially used across many of them without having to QA and launch so many changes. After getting some help from Dan Book and Ryan Voots on the #perl libera.chat IRC channel, I arrived at the following solution.
First, if all you want to do is alias the new method call to the…
Ten years ago Rudolf Winestock wrote The Lisp Curse, an essay that “attempt[ed] to reconcile the power of the Lisp programming language with the inability of the Lisp community to reproduce their pre- AI Winter achievements.”
His conclusion? The power and expressiveness of Lisp have conspired to keep its developers individually productive, but collectively unable to organize their work into complete, standardized, well-documented, ‑tested, and ‑maintained packages that they could coalesce into interoperable and widely-adopted solutions. Everything from object systems to types to asynchronous non-blocking programming and concurrency is up for grabs and has multiple competing implementations.
The following is adapted from my lightning talk “Blogging Outside the Bubble” at last week’s Perl and Raku Conference in the Cloud 2021. You can watch the presentation and download the slides here. Also, a tip: most of this applies to anyone who wants to start a blog.
Let’s say you’re a Perl developer distraught at the continued decline in usage and mindshare of your favorite language.
You know that you do good work and that your tools and techniques are sound, but the world outside of Perl-specific forums, software archives, social media groups, and IRC channels regards it as…
A mentee asked me over the weekend if there was a way within a Mojolicious web application to store the routes separately from the main application class. Here’s one way. These instructions assume you’re using Perl 5.34 and Mojolicious 9.19 (the latest as of this writing) via the terminal command line on a Linux, Unix, or macOS system; make the appropriate changes if this doesn’t apply to you.
First, if you haven’t already, create your Mojolicious app at your shell prompt:
$ mojo generate app Local::RouteDemo
[chmod] /Users/mgardner/Projects/blog/local_route_demo/script/local_route_demo 744
I wish they’d just leave Perl static. Then we wouldn’t have to waste money retesting legacy Perl apps on the newest version every couple of years, in case new features we don’t want breaks code that’s been unchanged for years. […] Sometimes things should just be left to die gracefully.
Programming languages, like all software, change to meet new challenges. Developers add new feature enhancements, users find bugs for them to fix, and occasional design errors need to be corrected. In Perl’s case, the Perl…
Last week saw the release of Perl 5.34.0 (you can get it here), and with it comes a year’s worth of new features, performance enhancements, bug fixes, and other improvements. It seems like a good time to highlight some of my favorite changes over the past decade and a half, especially for those with more dated knowledge of Perl. You can always click on the headers below for the full releases’
This was a big release, coming as it did over five years after the previous major 5.8 release. Not that Perl developers were idle—but it wouldn’t be…
Just another desperate Perl hacker