Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

BinGOs (7246)

BinGOs
  (email not shown publicly)
http://gumbynet.org.uk/

System administrator, part-time Perl hacker, full-time POE [perl.org] evangelist. One day he will be made to pay for his crimes.

He has some modules on CPAN [cpan.org]. They may or may not be useful

Journal of BinGOs (7246)

Sunday October 29, 2006
12:13 PM

More Irssi+POE madness

[ #31442 ]

A little while ago, I related how I'd been playing with Irssi and POE, well today I've been playing some more >:o)

Since my first journal entry on this subject, Martijn van Beers has released POE::Session::Irssi which makes the whole business of integrating Irssi and POE that little bit easier.

I wanted to see if I could run a POE::Component::IRC bot inside Irssi.

I had a bot called flibblebot that I have been playing with on Freenode for a while. So I took the source to that and started fiddling.

First I switched the POE::Session to use POE::Session::Irssi. Then had to change all my handlers to inline_state from package, as POE::Session::Irssi currently doesn't support object or package state handlers. Suck.

Then I started the script up in Irssi and it worked! Hurrah!

Except that I had left in print statements that spat debug info into my active Irssi window ... everytime someone said anything in one of the channels the bot was on. Doh.

Try to unload the script to find, that bot won't die. Damn it, POE::Component::IRC is not Irssi aware and is holding the POE::Session::Irssi open. Then I remembered that one can send PoCo-IRC a 'POCOIRC_SHUTDOWN' signal to tell it to .. erm .. shutdown. I wrote another small script to do that. Yay! The bot dies and I can unload the script now.

Right, I need to bind an Irssi command to terminate the bot

The final bot code is here

Postscript:

I have since been corrected about package_states. Irssi wraps scripts as Irssi::Script::scriptname-minus-pl I have adjusted the bot code accordingly

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.