samedi 28 novembre 2009

Playing with Perl

I'm a Perl beginner. Actually, what I read here and there let me think Perl is a pretty cool language. It does not need compilation, can be compatible with *nix and Windows. It has a powerful regex engine and quite a simple syntax. Finally, the large amount of modules available on CPAN can extend it in an amazing way.

The first real thing I made with is a tool to convert gmail contact list export file to something I can enter in my .muttrc (yeah, I use mutt with imap to retrieve my mail on gmail).

Data processing was quick to write. But it was hard to make it work. After a couple of hours (gimme a break, I'm a n00b, remember !), I figured out the contact.csv file was encoded in UTF16... Wait, what?! I've never seen this encoding before. Then, I was obliged to use iconv to preprocess the file and everything went fine!
Another trick is to check for unicity of mutt aliases.

If you're interested source is here. Obviously, it needs improvements.