Slash Boxes
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jest (4401)

  {jester} {at} {}

Largely unskilled but enthusiastic JAPH. In my other life I hack the Oxford English Dictionary.

Journal of jest (4401)

Wednesday December 03, 2003
10:30 AM

Users suck

I run a small library database for my company, most of which is based in England. Every month, a cron job sends a listing of newly added books, based on the record-creation date, to the library administrator, who then forwards it to everyone.

Yesterday, I got e-mail from the library admin, saying, "There was a problem with the book listthere were books on it that aren't new, but had just been edited in the past month. Several people complained, 'Wait, don't we already have that in the library?'"

So I run tests. I look over the code with a fine-tooth comb. As far as I can tell, there's absolutely no way this can be happening as described. I e-mail back, saying "Which books turn up as new that were already in? What sort of editing did the keyboarder to do these records?"

This morning I get an e-mail, "Well, the keyer didn't actually edit the entriesshe just deleted them and then added them again with the changes made."

$self->bang(head => $wall);

Wednesday October 29, 2003
02:19 PM

Refactoring the Wheel

Perhaps a year ago, I wrote some programs to deal with running a library database. The application worked nicely, but the programs were terrible--huge chunks of repeated, unmaintainable code.

A number of months ago, I learned a lot more about OO Perl, and went through a big refactoring binge and stuffed lots of things in modules.

A smaller number of months ago, I learned even more about OO Perl, and fixed some of the infelicities of the code.

A few days ago, I greatly generalized the code, so I can use the same modules to handle other databases I work with. This refactoring pass went very smoothly, and I felt confident. In the process I realized that one big chunk of the code is still appallingly bad; I spent a huge amount of effort on this elaborate solution to a problem that could have been solved much more easily if I had just used some templating system. (I had set up complicated modules to generate and process forms in a particular way.) So now I realize I have to go through and refactor this entire chunk to use TT or something, which will be non-trivial due to the complexity of the existing code.

When I'm finished with this, I will be in exactly the same place as over a year ago. I mean, I'll be a better programmer, and know a lot more, but this code has been in production use the whole time and no one knows I've done anything at all.

I suppose this is a good thing. But I'd like to throw in something neat, that I couldn't have done a year ago, or something.


Tuesday September 02, 2003
09:17 AM

I am a published Perl author!

It's true! My article "[Review of] Programming for Linguists: Perl for Language Researchers, by Michael Hammond" has just appeared in the Journal of English Linguistics, XXXI:3 (Sept. 2003). Props to my man Sean M. Burke for some very valuable comments on an early draft, which comments encouraged me because they exactly matched what I had already decided about the book.

The review is considerably more critical than the one that appeared on Linguist List earlier this year.

But enough of that. I have published about Perl in a peer-reviewed journal! I'm all grown up! Why, I think I even understand closures now!

Tuesday August 05, 2003
10:45 AM

$self->bang({head => "wall"});

So last night I sit down to do a big refactoring job on some code. It should be fairly straightforward; I'm not changing how anything is done, just some of the structure of the OO code to make it more like an MVC approach.

And for no reason I can think of, this one aspect of the display is not working. It's effectively identical to what was there before, and it works on the first run of this one program, but when the program is re-called, a radiogroup gets messed up. And I just can't figure out why it's happening. Worse, changing around things that should make absolutely no difference cause it to work.

I go to sleep late, having accomplished very little, and in the morning ask another coder to look at it. He can't figure it out either. Finally, for the hell of it, I change this one variable from




, and lo! it's working!

But I don't know why.

Oh, and happy birthday to me!

Wednesday July 30, 2003
07:44 AM

Still on a roll

Thanks especially to some very helpful comments from ziggy, I managed to have another burst of productive programming last night, wiping away the worst remaining bit of cruft from my app. Now to revise my definition of 'cruft' downwards, and go to it again....

In the process I also managed to get my banal question frontpaged on perlmonks, but got the answer I needed.

On the other hand, the revolting food over here is really killing me.

Monday July 28, 2003
03:47 AM


After a depressing week of learning C, during which I worked very hard and spent much time each evening rigorously working through exercises, I returned to Perl. And god, what a joy! I had put aside a problem I had been having, and then after an encouraging e-mail from Sam Tregar, whose book I found very helpful, I returned to my Perl problem and solved it within minutes.

Of course, it's still a mess; I took some octopus-like code and "improved" it by hacking off the tentacles and stuffing them in modules, so now I have my code writhing away somewhere behind the scenes. I have to learn lots more about subclassing and such to make this really effective. And, especially at this point, when I'm changing the code very frequently, the OO approach is really confusing, since it takes me more time to sort through six modules to figure out where something is happening than it did when everything was in one bloated script.

But I feel like I'm making progress.

Whether any of this is because of C is an open question.

Tuesday July 22, 2003
04:21 AM

Does knowing C help write Perl?

Out of some weird sense of completeness, I've decided recently to put some effort into learning C. I'd like to understand more about how things actually work, and I'd like to be able to contribute in some more serious way to projects, like Perl, that I like. Also, I had the vague notion that it would make my Perl better.

This is really hard. I'm not a math type, and I've never understood much about pure comp science, so everything is really confusing. I've been working through K&R, which is really advanced. (Aside: I also bought the Oualline book from O'Reilly, which has a weird set of Amazon reviews--some one-star reviews saying "this is too hard!", and then five-star reviews saying "this is real programming--get over it! It's a great book." However, the book is a joke compared to K&R. 70 pages into it, you're still on "Hello, world!" level stuff, while K&R has you working out genuinely difficult things from about page 5.)

First of all, every exercise, I think "I could do this in Perl in about seventeen characters." Perhaps that's the point. But I also find that I often have a good sense of how to do something, I just don't know how to execute it. And I spend all my debugging time realizing that I meant

i <= len

, not

i < len

, etc. If I wanted to have to know math, I wouldn't have read Classics. I'm also not sure what Perlish practices should be used in C, or what will make me look like a dork--e.g. using curly braces around single statements in C:

  for (i = 0; i < MAX; ++i) {
    printf("%d: %d",i,value(i));

I'm beginning to wonder what the point of all this is. I'll never be good enough at C to actually contribute to the Perl core, or to debug perl. Will this make me a better person? Will it improve my Perl code?

Saturday July 19, 2003
12:27 PM

Arrival in Oxford

Well, here I am in Oxford, with the kids in tow and not-too-bad jetlag, surprisingly. The room I'm in has some bizarre ancient method of connecting to the Net, which means I have to use the horrid Win98 hulk sitting here instead of plugging in my laptop, but whatever.

After a reasonable night's sleep I should be ready to go! Oh, after giving the kids a tour of the city. Responsibility, responsibility.

Wednesday July 16, 2003
11:59 AM


Grr. I've lately been working on a database-to-Web application. Originally it was incredibly redundant, with tons of cut-and-pasted code; lately I've been working hard to modularize it, with much help from my main man ziggy. This has gone fairly well but is still a lot of work because, well, there's a lot to do.

So of course seeing today's article on on this exact subject, but made easier by using TT and Class::DBI, is just making me really frustrated. I've looked at both of these before, but thought either that they'd be too hard to use, or would too obscure the close control over my code that I sort of think I want. But now I'm wondering if perhaps I should consider it.

Which will, of course, necessitate yet another big round of re-writing.

Perhaps I'll chuck it all and just finally try to teach myself C.

Monday July 14, 2003
01:50 PM

Saying hello


I've been using Perl for several years, not especially well, but in spite of that I enjoy the hell out of it and wish I could do more. Thus, here I am.