Slash Boxes
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)

  (email not shown publicly)

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

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

Journal of BinGOs (7246)

Thursday October 05, 2006
05:19 AM

Irssi+POE script goodness

[ #31221 ]

A while ago Martijn van Beers introduced me to the idea of running POE inside Irssi IRC client.

Now this sounded like a really cool idea to me.

I had Irssi installed already with Perl support and POE (of course), so it was a case of installing POE::Loop::Glib.

use Irssi;
use Irssi::Irc;
use Glib;

my $win = Irssi::active_win();
$win->print ('DEPTH ' . Glib::main_depth);

use POE qw(Loop::Glib);

$VERSION = "0.2";
%IRSSI = (
    authors     => 'Martijn van Beers',
    contact     => 'martijn[at]',
    name        => 'memephage',
    description => 'send urls to proximity store',
    license     => 'GPL',
    url         => '',

POE::Session->create (
        inline_states => {
                _start => sub {
                        my $kernel = $_[KERNEL];
                        $kernel->delay_add ('foo', 4);
                foo => sub {
                        my $kernel = $_[KERNEL];
                        my $w = Irssi::active_win();
                        $w->print ('POE FOO');
                _stop => sub {
                        my $w = Irssi::active_win();
                        $w->print ('POE STOP');


Martijn provided me with the above script (which I have amended slightly) for testing that Irssi and POE were now best of buddies. Save it to ~/.irssi/scripts as and in Irssi use the command /SCRIPT LOAD 'POE FOO' should be written to the active window after 4 seconds, then 'POE STOP'. Very nice. But not that useful.

So a more useful application was a script for managing individuals on Freenode #perl channel, the code for which is here.

Some caveats are:

  • There is no need to explicitly run the POE::Kernel
  • Using /SCRIPT UNLOAD does not stop the session
  • Sessions created in different scripts can communicate with each other using normal POE semantics.

Many interesting things are bubbling through my mind about how to abuse this, I'll write some more as they occur to me >:o]

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