I've been working really hard on the POE tutorial lately for OSCon. It's a very long thing to write, since POE is quite in-depth. But it's going to be good.
One of the things that I've come across is that some of the components on CPAN for POE don't exactly work how I'd expect a POE component to work, or certainly not how I'd like them to work.
Take POE::Component::IRC as an example. In order to create a bot that joins a channel you need to do at least 5 things:
- Create a PoCo::IRC instance
- Create a POE::Session instance, with an _start handler, and a bunch of events that correspond to PoCo::IRC event names
- register all your events with the PoCo::IRC instance
- in your _start handler, you tell the PoCo::IRC instance to connect to a server
- In the irc_001 event handler you join your channel
That seems like an awful lot of work to me... And it doesn't stop there - you have to write your own reconnect code, your own ping code, and so on.
So I wrote a wrapper. It's basically a class that you have to subclass to create a bot. Then you create an instance of your class, passing in the server name, the nick, etc. Then all you have to do is define an irc_001 method in your subclass, and that gets called automatically when you are connected (so you can join channels, etc). The base class also takes care of reconnects and pings and stuff.
Anyway, I'm going to wait until Dennis (the author of PoCo::IRC) has a look at the docs so he can see if he thinks the interface is good, and then I'll upload it to CPAN.