emailbot for Buffy

2shortplanks on 2001-08-21T22:07:48

So yesterday Celia complained at me that I never answer her mails, which is blatantly untrue. Actually, I never answer her mails in time which, admittedly, in the end is all and all the same thing. This time it was actually critical...she wanted to know if I'd bought the next set of Buffy videos or not or should she buy them and bring them round. I hadn't and because I didn't mail her back neither did she so none of us got to watch any Buffy last night. This is not good.

So I decided to do something about it. Now I have my funky Mail::Audit script running I figured that I should get it to take some drastic action when I actually get mail sent directly to me (rather than just via the millions of email lists I seem to be on.) Since I spend quite a lot of time hanging out on IRC I figured it'd be a good idea to have it /msg me on there whenever I got a mail.

In a spare hour recently I'd written a couple of bots in POE...one that simply reversed whatever you said to it, the other that looked up the titles of web pages (in a non-blocking way of course - this is POE.) Adapting my code from this I hacked in a quick SocketFactory that listens on a socket and simply /msgs me any text that is sent to it. Three lines added to the Mail::Audit script to open, print to and then close an IO::Socket and we're in business.

Perl is so great for rapid development of simple things.