AaronCrane.co.uk

Articles tagged “Programming”

Perl 5.17.8’s release epigraph

Yesterday I had the pleasure of releasing version 5.17.8 of Perl. Perl has had regular, time-boxed monthly development releases for about three years now. This great improvement on the previous situation has been accomplished partly by making the release process into something that can be done even by people who, like me, are far from being experts in Perl’s internals.

One of Perl’s long-standing traditions is that release announcements are accompanied by an epigraph, chosen by the release victim volunteer. Here are some notes about the epigraph I picked for 5.17.8.

More…

Using git jump with Emacs

Git version 1.7.8, which is shortly to be released at this writing, contains a handy new program git jump. The idea is that you can say things like git jump diff to have your $EDITOR go directly to the lines within your files that contain unstaged changes.

The design of git jump is particularly helpful for Vim users, but what if you prefer Emacs?

More…

How not to handle errors

Sometimes the code running a dynamic website will encounter errors. There are a variety of ways to handle runtime errors, of course. Some are better than others, and today I encountered a site that manages to get a surprising number of things wrong.

More…

Perl safe signals

Once upon a time, handling signals in Perl code had a pretty big gotcha — one that you couldn’t work around. Perl 5.8 changed signal handling in a way that eliminated that gotcha, but replaced it with a different one, harder to trigger, but no less surprising.

More…

The runN program

Nearly a year ago, Mark Jason Dominus blogged about runN, a program he’d written. I’ve stol– uh, I mean, adapted his version for my own ends, with a couple of differences. This is a rationale for my changes.

More…

MeWare

Eric Sink has an interesting piece about MeWare, ThemWare, and UsWare. The basic idea is that one way of categorising software is by who uses it:

  • MeWare: only the developer
  • UsWare: the developer, among others
  • ThemWare: people other than the developer

I think most programmers can see what Eric’s getting at there. If you’ve ever worked on, say, a piece of software used exclusively by people in a different department of the company you work for, you know how hard it can be to ensure that the software actually meets those people’s needs.

However, I took issue with one particular thing Eric says.

More…

Software tools and cross products

A colleague approached me today regarding a unit test he was writing. He was constructing a series of test cases from a data structure; his code at the time used a multi-line string of which each line had several fields which together described a test to run.

More…

Numbers and strings in MySQL

Here’s a MySQL query issued by some Perl code:

$db->do(q{
    CREATE TEMPORARY TABLE byline_age (
        byline_id int PRIMARY KEY,
        last_used int not null
    )
    SELECT byline_id, MAX(IfNull(published_at, ?)) AS last_used
    FROM article
    GROUP BY byline_id
}, undef, time());

Spot the bug? No, nor did I.

More…

Book Review: Mastering Regular Expressions (3rd Edition)

[Also published here.]

Mastering Regular Expressions has been around for a long time — this is the third edition of a book originally published a decade ago. Does that actually reflect justified popularity, or is it just that this is the only book-length treatment of the various regex engines, how they differ, and how to get the most out of them? I’m glad to say that doesn’t seem to be case: if you use regexes in any depth at all, you should probably read this book.

More…

Regex matching algorithms and asymptotic run time

[Previously published here.]

Russ Cox recently wrote an article about the worst-case run time of two different implementation strategies for matching regexes: Thompson NFA, and backtracking NFA. In particular, Russ points to the Perl regex engine as an example of how not to do it.

The article’s an interesting read. But I don’t think the approach described is necessarily easy and/or useful to fit into Perl, though.

More…