Tuesday, March 22, 2005

more perl fun

Two fixes in two days for my mail reader. This is some kind of record!

The attachment downloader was having some problems when the filename included odd characters. Realized that a) I was not URL-encoding the filename in the attachment link and b) I was unencoding the filename in the script that sends the file (which is completely unnecessary).

Fixed and fixed.

Monday, March 21, 2005

regular expressions and other perl fun

So I have a home-grown, web-based, POP3 e-mail reader written in perl. Nothing fancy. Not really that great, but it works ... at least until I replace it with something more worthwhile like Horde IMP. Until the day comes that I replace my frankencode I do my best to keep it, at a bare minimum, functional. So I guess while I'm lazy enough to avoid implementing a better system I'm not too lazy to make the occasional fix and/or upgrade to my own creation. I guess I like the challenge more than anything else.

Anyway, the script recently began having some problems with the date parser. My original regular expression for pulling the date from the header was hitting a wall with a certain malformed value. You always think it's good enough to get by until something weird comes your way. My new regex date parsing code:
/(\d{1,2})\s(\w{3})\s(\d{4})\s(\d{1,2}):(\d{1,2}):(\d{1,2}).([+-]\d{4})?/i
Ugly, yes. Efficient, no. Functional ... well, at least until the next funky date comes along.

One of the effects of the update is that e-mail with an invalid date (or no date at all) are relegated to the bottom of the list. Where they went before I do not know.

I also noticed that the per-page message cache creation loop and display loop were both written incorrectly and thus some weirdness was happening with the inbox listing. (damnable zero-based indexes and what not).

These are not, by the way, the only known bugs. I have quite a bit of work to do to get the message parser up-to-snuff. Among the many problems the most in need of a little work are the few cases where the body of a message will not be displayed. I think it has something to do with HTML-based messages, but I haven't taken any time to fix this one just yet.

3 Months?!?

A blog sure sounds like a good idea when you've got all these thoughts running around in your head. Yet somehow I never seem to be able to find the time to devote to it. Oh well, maybe if I keep it up at this pace google won't kill my account.