Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

Problem on POE::Component::IRC::Plugin::Logger

by Kamikaze (Initiate)
on Jul 21, 2009 at 18:26 UTC ( [id://782044]=perlquestion: print w/replies, xml ) Need Help??

Kamikaze has asked for the wisdom of the Perl Monks concerning the following question:

Hi all!!
I'm making a bot using perl with POE::Component::IRC , and for now all is well. But I have a problem with the logger pluggin of POE I've been documenting for pluggins, and I have no problem with others, but this fails.And apparently not output any error.
Only i have problem when i dont use 'Path'.
I publish my code, maybe someone has a solution or tell me how to find the solution.
Data:
Perl Version: 5.10.0-19
POE Version: 6.09
#!/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_publi +c) ], ], 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::BotT +raffic->new() ); $irc->plugin_add('Logger', POE::Component::IRC::Plugin::Logger->n +ew(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; }
After launching it, everything it's ok, the BotTraffic run perfectly. And 'Logger' pluggin, gives no error when loading. Lines that appear when launching the script.
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(0x +86522b8)' irc_connected: 'dune.irc-hispano.org' irc_notice: 'dune.irc-hispano.org' [IP_LOOKUP] '*** Found your hostna +me (CACHED!).' irc_ping: 'eMa8oAUCf6UWWOKo' Connected to dune.irc-hispano.org irc_002: 'dune.irc-hispano.org' 'Your host is dune.irc-hispano.org, r +unning version u2.10.H.10.110' [Your host is dune.irc-hispano.org, ru +nning version u2.10.H.10.110] irc_003: 'dune.irc-hispano.org' 'This server was created lun mar 2 20 +09 at 13:47:21 CET' [This server was created lun mar 2 2009 at 13:47: +21 CET] . . .
And I have tried different routes in the variable 'Path', and i revised the permits ... and nothing, they was ok. But nothing, the log not create.
I can not think of anything ... something is beyond me and not that, maybe someone see something more ...
A greeting and thanks
PD<> Sorry for my poor english

Replies are listed 'Best First'.
Re: Problem on POE::Component::IRC::Plugin::Logger
by bingos (Vicar) on Jul 21, 2009 at 21:22 UTC

    From the documentation for the logger plugin, I gather that the IRC component must be of the POE::Component::IRC::State variety.

    This plugin requires the IRC component to be POE::Component::IRC::Stat +e or a subclass thereof. It also requires a POE::Component::IRC::Plug +in::BotTraffic to be in the plugin pipeline. It will be added automat +ically if it is not present.

    Change the line:

    my $irc = POE::Component::IRC->spawn(

    to

    my $irc = POE::Component::IRC::State->spawn(

    and it should work.

    The Logger plugin is die'ing when it is being registered, but that is being masked by an eval wrapper in the plugin system. Setting the plugin_debug option to a true value in the spawn constructor would show this.

    my $irc = POE::Component::IRC->spawn( nick => $nickname, ircname => $ircname, username => $username, server => $server, plugin_debug => 1, ) or die "Oh noooo! $!";
      Thanks!!! for your response 'bingos'!!!
      Finally i was added one line in 'use' area to all go perfect.
      use POE::Component::IRC::State;
      Bye!!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://782044]
Approved by ikegami
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others pondering the Monastery: (8)
As of 2024-04-25 15:08 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found