GSP
Quick Navigator

Search Site

Unix VPS
A - Starter
B - Basic
C - Preferred
D - Commercial
MPS - Dedicated
Previous VPSs
* Sign Up! *

Support
Contact Us
Online Help
Handbooks
Domain Status
Man Pages

FAQ
Virtual Servers
Pricing
Billing
Technical

Network
Facilities
Connectivity
Topology Map

Miscellaneous
Server Agreement
Year 2038
Credits
 

USA Flag

 

 

Man Pages


Manual Reference Pages  -  POE::COMPONENT::IRC::OBJECT (3)

.ds Aq ’

NAME

POE::Component::IRC::Object - A slightly simpler OO interface to PoCoIRC

CONTENTS

SYNOPSIS



  package ElizaBot;
  use Chatbot::Eliza;
  use POE;
  use POE::Component::IRC::Object;
  use base qw(POE::Component::IRC::Object);
 
  BEGIN { $chatbot = Chatbot::Eliza->new(); }
 
  sub irc_001 {
    $_[OBJECT]->join( "#elizabot" );
    print "Joined channel #elizabot\n";
  }
 
  sub irc_public {
    my ($self, $kernel, $who, $where, $msg) =
      @_[OBJECT, KERNEL, ARG0, ARG1, ARG2];
   
    $msg =~ s/^doctor[:,]?\s+//;
   
    my ($nick, undef) = split(/!/, $who, 2);
    my $channel = $where->[0];
   
    my $response = $chatbot->transform($msg);
    $self->privmsg( $channel, "$nick: $response" );
  }
 
  sub irc_join {
    my ($self, $who, $channel) =
      @_[OBJECT, ARG0, ARG1];
   
    my ($nick, undef) = split(/!/, $who, 2);
    $self->privmsg( $channel, "$nick: How can I help you?" );
  }
 
  package main;
  use POE;
 
  ElizaBot->new(
    Nick => doctor,
    Server => grou.ch,
    Port => 6667,
  );
 
  $poe_kernel->run();
  exit(0);



DESCRIPTION

Quite simply, I didn’t like the way the module POE::Component::IRC worked. I felt like it required me to do too many things - create a PoCo::IRC instance for each IRC client, and then create a session, and in the _start for the session I was supposed to connect to the server and do all the right things.

For an IRC client that connects to multiple channels from one piece of code this is good. But for me it was too flexible. So I wrote this module.

Oh, and this module also saves you some typing.

Basic usage is to create a subclass of this module. In that subclass define events according to the event names in POE::Component::IRC.

This module has pretty good reconnect code in (i.e. reconnect if we get disconnected by accident, and keep retrying indefinitely). But it will break if you redefine the irc_error, irc_connected, or reconnect methods. So don’t do that ;-)

Any methods that you call on the object will be passed through as $kernel-post()> calls to the underlying POE::Component::IRC object. This makes it very easy to return messages, via $self->privmsg($channel, $text) and so on.

BUGS

Probably some. Some may consider it a bug that the whole module uses AUTOLOAD and _default to send calls to the right place.

LICENSE

This is free software. You may use and distribute it under the same terms as perl itself.

AUTHOR

Matt Sergeant - matt@sergeant.org
Search for    or go to Top of page |  Section 3 |  Main Index


perl v5.20.3 POE::COMPONENT::IRC::OBJECT (3) 2002-07-02

Powered by GSP Visit the GSP FreeBSD Man Page Interface.
Output converted with manServer 1.07.