They say that programming in a language is just like riding a bicycle – once you master it, you never forget it. But they say a lot of things that aren’t true. So I’ll confess to having a doubt or two about my perl prowess when I took a look inside Standalone Trackback. Because there were an awful lot of punctuation marks in there.
I started by refactoring the code. There was a big case statement at the top and I made each case action an independent subroutine. Not truly necessary, but a good way of establishing familiarity with the control flow. I had just read Charles Miller’s post on the Noun-Verb naming pattern, so I gave it a whirl (renaming some existing routines along the way). I typically use Verb-Noun, but I have to say that Noun-Verb grows on you. Definitely worth considering on your next project.
After searching about the internet, I decided to borrow some code from Brad Choate’s Movable Type Sanitize Plugin. Fortunately, the code was available as a perl module and easy to add. The sanitize module experience was so nice that I decided to move some of the trackback code into a module as well. And right about then I realized that the perl portion of my brain was back – the punctuation marks all made sense.
I expect to have trackback up and going in a few more days. Drop me a line if you’re interested in checking it out.