Class::Accessor can has “has”

I maintain the Class::Accessor module. It appears to be used a lot, but the API is a bit ugly. In YAPC::Asia the ugly API was criticised in at least three different talks, and each time it was compared to the fashionable Moose API.

In one of these talks JRockway asked Shawn Moore how to turn a bad API into a good API, so I’m going to try that: adding antlers to Class::Accessor!

So now instead of writing:

package Foo;
use base qw(Class::Accessor);
Foo->mk_accessors(qw(alpha beta gamma));

If you prefer Moose-style you can write:

package Foo;
use Class::Accessor "antlers";
has alpha => ( is => "rw" );
has beta  => ( is => "rw" );
has gamma => ( is => "rw" );

The original API is still available, and everything is the same underneath.

It’s alive!

My blog: it’s alive!

I don’t post very often, but I’m going to try to change that. Is this my fifth attempt?

This time, to give myself a goal, I joined the Perl Ironman Challenge and I will try to blog at least once a week about Perl. So…

Perl: it’s alive!

There have been lots of reports over the last few years about Perl being dead. Those reports upset a lot of Perl mongers, and I didn’t fully understand that. Perl was not a family member, friend, or pet; so why the strong emotion? It was never really “alive”, so how did it “die”? And all these upset people were still using Perl, so they kept it breathing. And there were many more Perl users who weren’t upset, maybe because they never heard about the death.

It seems to me that Perl never died: it just became unfashionable for a while. And during the unfashionable period Perl did have some self-image issues, and maybe a lot of misdirected energy. But being unfashionable isn’t life-threatening.

All your base are belong to us

We were all amused by the bad translation in the “All your base” meme some years ago. I was thinking about it recently (for other reasons) and wondered how Google translate would handle the same Japanese source material: 「君達の基地は、全てCATSがいただいた」

Google said: “You are our base, all you CATS”. I contributed a better translation.

I thought the original phrase would be entertaining because it contains a Japanese verb that Google mistranslates brilliantly: いただく。

「いただく」 means “receive” or “accept”. But it’s a humble verb, so the receiver has a lower status than the giver and so receives with gratitude. I suspect that Oliver Twist would use a form of this verb when asking for more gruel.

If you were the receiver and used this verb you would most likely use it in the form of 「いただきます」(the same verb with the normal polite ending). And this is where Google translate gets really confused. Because, unless you frequently get gifts from important people or work in a shop, the most common situation where you would use this word is at the start of a meal: you’ve just been given some food, and you’re thankful, so you say “I (gratefully) accept (this food)”. It’s slightly idiomatic, although the meaning is clear. It’s a bit like “saying grace”. But a popular idiomatic expression used in that situation by many English speakers is (the French phrase) “Bon appétit”. Therefore Google always (as far as I can tell) translates 「いただきます」 as “Bon appétit”.

That really doesn’t work well if the main verb in your sentence is “receive”. One example, appropriate at this time of day, would be 「お休みをいただきます」, for which I would say “thankfully I’ll get some rest”. Google says “Rest for a bon appétit”.

Cheap Flights

I had collected a lot of frequent flier points with BMI, and today was a good time to use them to get flights for Karen and me. Recently Tony has been investigating BMI points and had given us some advice. The strangest bit was “when you phone them, if a guy answers, hang up; only talk to the girls”. Apparently the men are useless.

My experience tonight supports that claim. When I first called them a guy answered, but I didn’t hang up. I asked for flights on dates that I knew had available seats for points (since I had checked on the ANA site; another bit of advice from Tony). But, with barely a pause to enter the information, the guy said there was absolutely no availability on those dates. He didn’t suggest any other options. So I hung up.

I immediately hit redial, and this time spoke to a girl who happily helped me get the flights I wanted.

My Minority Report

Recently Karen talked and blogged about role models in technology, and referred to the “underrepresentation of women and minorities”. I believe that diversity and equal opportunity are essential in the workplace, both for moral and practical reasons. But most (not all) conversations about “minorities” annoy me, and now I realise why: it’s how the minority classes are defined.

I’m a white male, so the naïve observer may think “not black, not female, therefore not minority” (a fallacy, of course). Many of these observers claim to oppose racism and sexism, but still use my skin colour and gender to classify me. They justify that discrimination by saying that it has no negative impact on me because I’m part of the majority group. Are they really saying “you white guys all look the same”? Or worse, “all you white guys are the same”?

I’m actually a member of one minority group that is 0.00026 of the world’s population. I look like a short hairy version of the standard white guy, and I speak a dialect of the standard language. But the dialect reflects a cultural difference in thinking. And since “technology” as an industry is founded on thinking (although sometimes it doesn’t seem so) it is the difference in thinking that should be considered.

Making Alan’s blog less slow

I tried to find out what was causing Alan’s blog to take well over 3 minutes to load, and I found a few problems.

The biggest problem was his tag cloud generator from zoomclouds.com. It appears that their service is currently dead (it doesn’t ack my syn), so I set my local packet filter to reject connection attempt to their site, and that made it much better.