#!/usr/bin/perl use strict; use warnings; use POE qw(Component::IRC); use POE::Component::IRC::Plugin::BotTraffic; use POE::Component::IRC::Plugin::Logger; my $nickname = 'Fulgor101'; my $ircname = 'Observando'; my $server = 'dune.irc-hispano.org'; my $username = 'Fulgor'; my @channels = ('#pruebas'); # We create a new PoCo-IRC object my $irc = POE::Component::IRC->spawn( nick => $nickname, ircname => $ircname, username => $username, server => $server, ) or die "Oh noooo! $!"; POE::Session->create( package_states => [ main => [ qw(_default _start irc_001 irc_public irc_bot_public) ], ], heap => { irc => $irc }, ); sub _start { my $heap = $_[HEAP]; # retrieve our component's object from the heap where we stashed it my $irc = $heap->{irc}; $irc->yield( register => 'all' ); $irc->yield( connect => { } ); $irc->plugin_add( 'BotTraffic', POE::Component::IRC::Plugin::BotTraffic->new() ); $irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->new(Path =>'home/user',Private => 1,Public => 1,DCC => 1, )); return; } . . . sub irc_bot_public { my ($kernel, $heap) = @_[KERNEL, HEAP]; my $channel = $_[ARG0]->[0]; my $what = $_[ARG1]; print "I said '$what' on channel $channel\n"; return; } #### user@Box:~$ perl 3cosa.pl irc_registered: 'POE::Component::IRC=HASH(0x86873c0)' irc_plugin_add: 'BotTraffic' 'POE::Component::IRC::Plugin::BotTraffic=HASH(0x86982d8)' irc_plugin_add: 'Logger' 'POE::Component::IRC::Plugin::Logger=HASH(0x86522b8)' irc_connected: 'dune.irc-hispano.org' irc_notice: 'dune.irc-hispano.org' [IP_LOOKUP] '*** Found your hostname (CACHED!).' irc_ping: 'eMa8oAUCf6UWWOKo' Connected to dune.irc-hispano.org irc_002: 'dune.irc-hispano.org' 'Your host is dune.irc-hispano.org, running version u2.10.H.10.110' [Your host is dune.irc-hispano.org, running version u2.10.H.10.110] irc_003: 'dune.irc-hispano.org' 'This server was created lun mar 2 2009 at 13:47:21 CET' [This server was created lun mar 2 2009 at 13:47:21 CET] . . .