NAME

PogoBOT::Interface - Encapsulates the PogoBOT protocol


SYNOPSIS

  use PogoBOT::Interface;
  
  my $bot = new PogoBOT::Interface;
  $bot->register_cmd( 'hello', \&hello_world );
  $bot->register_cleanup( sub{ print "Cleaning up 'hello' routine.\n" } );
  $bot->start;
  sub hello_world {
      return "Hello, World!";
  }


DESCRIPTION

Simplifies writing modules that connect to bots implementing the PogoBOT protocol.


METHODS

new
Creates a new PogoBOT::Interface object.

Can optionally be passed an array of argument pairs: host => $host to set the hostname to connect to, port => $port to set the port to connect to.

By default the interface will attempt to connect to port 2112 on localhost.

$bot->start
Connects to the core, registers all the commands, and starts a loop. When the socket closes, calls all the cleanup routines. Will reconnect to the core if it dies, with exponentially increasing intervals of up to five minutes.

Takes no arguments, and does not return.

$bot->register_cmd($command_name, $subref)
Register a command with the interface. Takes two arguments, both required: $command_name is the name of the command. $subref is a subroutine to call when the command is triggered.

$bot->register_help
Currently unimplemented. Once we write a help module, this can be fixed.

$bot->register_cleanup($subref)
Register a subroutine or list of subroutines to be called when the connection is closed.


AUTHORS

Tim Retout <tim@retout.co.uk> and Laurence Hurst <laurence2@uwcs.co.uk>


BUGS

Please report any bugs to the authors, who can usually be found in #compsoc on irc.uwcs.co.uk.


COPYRIGHT

Copyright (C) 2005,2006 by the authors.