#!/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; }