Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

Using POE::Component::IRC

by dReKurCe (Scribe)
on Jul 03, 2005 at 19:54 UTC ( #472063=perlquestion: print w/replies, xml ) Need Help??

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

Greetings Monks:

I am new to object orientation and am learning by example. I have read the Net::IRC documentation and discovered along the way that POE provides a better solution. The following code is from the module documentation but alas I am missing the plot. The following code generates:
Can't call method "post" on an undefined value at POEirc line 14. POE::Kernel's run() method was never called.

Any advice on how to tweak this could enrich my knowledge of OO . thanks.
use POE::Component::IRC; my ($irc)=POE::Component::IRC->spawn()or die; $irc->yield ('register' => 'all'); $irc->yield('connect', { Nick => 'n3u7bot', Server => '', Port => 6667, Username => 'HAL', Ircname => 'darkphiber', } ); $kernal->post( 'my client ', 'join', '#2600tn' );

Replies are listed 'Best First'.
Re: Using POE::Component::IRC
by johnnywang (Priest) on Jul 03, 2005 at 22:00 UTC
Re: Using POE::Component::IRC
by bart (Canon) on Jul 03, 2005 at 20:30 UTC
    Nowhere at all do you assign a value to $kernal. Of course does it contain an undefined value.

    update: I checked the example code in POE::Component::IRC. their code talks about "$kernel". Perhaps you just have a typo?

    I am assuming use of that module automatically uses (and assigns to) the (global) variable $kernel. I'm not sure about that.

    Nope, I doubt it. I think you actually have to combine this module with plain POE. Bad module documenters. This is not clear at all.

Re: Using POE::Component::IRC
by Anonymous Monk on Jul 04, 2005 at 01:06 UTC
    Net::IRC is much easier to install, understand and use. It takes less memory and isn't prone to spawn a hundred zombies if you make a mistake. I'm curious about why POE provides a better solution? Thanks.
      This is not a direct answer to your question, but I did find some problems with Net::IRC.

      I recently found that SlashNET presumes that a client is disconnected if it does not send PING messages at a regular pace. Net::IRC doesn't, and trying to fix it using do_one_loop made me discover that this function should be called from a package when working with use warnings;. I also had to hack the module to add support for the PONG answer message.

      perl -ple'$_=reverse' <<<ti.xittelop@oivalf

      Don't fool yourself.

Log In?

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://472063]
Approved by davidrw
Front-paged by grinder
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others perusing the Monastery: (2)
As of 2022-05-22 23:39 GMT
Find Nodes?
    Voting Booth?
    Do you prefer to work remotely?

    Results (81 votes). Check out past polls.