Saturday, November 18

App::WRT - WRiting Tool, a static site generator and related utilities

Probably a decade after the first time I put it on a TODO list, I finally got around to publishing this site’s underlying software on CPAN. It didn’t used to be called App::WRT; for a long time it was just, and then when I turned it into (sort of) a library.

Last February, I switched it from CGI that ran server-side on every page request to a site generator that would render the entire site to static HTML files. That July, after agonizing about good command names not already taken by real software, I switched the command-line interface from display to wrt, short for writing tool. CPAN naming guidelines suggest putting this sort of thing in the App namespace, so that’s what I did.

CPAN is the Comprehensive Perl Archive Network, a big repository of libraries, utilities, and documentation in Perl. Which is to say that it’s Perl’s answer to npm, Packagist, RubyGems, PyPI, etc. (It would probably be more accurate to say those things are other languages' answer to CPAN, since CPAN dates to the mid-1990s.)

I’ve generally had a bad experience with language-specific package management systems, but after all these years CPAN remains an exception, for all of its foibles. Publishing a release to CPAN turns out to be a very 1990s / early 2000s kind of experience, with a wait to see results and a generally piecemeal feeling. It suffers by comparison to the “push a git tag to the remote” approach to creating a “release” on GitHub. On the other hand, it pushed me to make a bunch of improvements to the documentation and fill out a handful of the features that wrt needs to be usable as a standalone tool.


I know no one else will ever use this thing. In case you did want to, installing on most GNU/Linux systems should be as simple as running:

$ sudo cpan -i App::WRT

Or, if you happen to have cpanm installed:

$ sudo cpanm App::WRT

Once installed, you should be able to run wrt:

$ wrt
wrt - a writing tool

Usage: /usr/local/bin/wrt [command] [args]
    wrt init        Initialize a wrt repository
    wrt display     Print HTML for entries
    wrt render-all  Render all defined entries to filesystem
    wrt addprop     Add a property to an entry
    wrt findprop    Find entries containing certain properties
    wrt -h          Print this help message

You must specify a command.

In order to make an entry for the current day, create a file like archives/2017/9/18, and write some HTML in it. Or use Markdown, like so:

<h1>Saturday, November 18</>

Your text here.

If I live long enough, I might get around to rewriting wrt in something else, but aside from C, I’m not sure I could have started out by picking a language more boringly likely than Perl to keep working for a couple of decades.

The underlying archive format could be better in some ways, but so far it’s also been fairly future-proof. My only real worry is that one of these days, as the open web vanishes further into the maw of facegooglemazon, HTML itself may start to seem like a bad idea. In that case, however, it should be pretty easy to convert the simple subset of HTML I’m using here to some other language.

tags: topics/cli, topics/perl, topics/shell, topics/technical, topics/warelogging, topics/wrt

p1k3 / 2017 / 11 / 18