File: logger.pl

package info (click to toggle)
libpoe-component-irc-perl 6.35%2Bdfsg-1
  • links: PTS, VCS
  • area: main
  • in suites: squeeze
  • size: 1,520 kB
  • ctags: 1,061
  • sloc: perl: 14,612; sh: 48; makefile: 5
file content (26 lines) | stat: -rwxr-xr-x 758 bytes parent folder | download | duplicates (7)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
#!/usr/bin/perl

# This is the most succinct IRC logger bot script in the history of the universe
# Author: Hinrik Örn Sigurðsson, <hinrik.sig@gmail.com>

use strict;
use warnings;
use POE;
use POE::Component::IRC::State;
use POE::Component::IRC::Plugin::AutoJoin;
use POE::Component::IRC::Plugin::Logger;

my $nick = 'mylogbot';
my $server = 'irc.blahblah.irc';
my @channels = ('#chan1', '#chan2');
my $path = "$ENV{HOME}/irclogs";

my $irc = POE::Component::IRC::State->spawn(
    Server => $server,
    Nick => $nick,
);
$irc->plugin_add('AutoJoin', POE::Component::IRC::Plugin::AutoJoin->new( Channels => \@channels ));
$irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->new( Path => $path ));
$irc->yield('connect');

$poe_kernel->run();