NAME

Bot::Net::Server - mixin class for building Bot::Net servers

SYNOPSIS

bin/botnet server --name Main --mixin IRC

DESCRIPTION

This is the main mixin class implemented by all Bot::Net servers. A server may facilitate the communication between bots. In some cases, a server may also simultaneously be a bot too (IRC server bots can be helpful for authentication and channel and nick management, for example).

METHODS

import

Custom exporter for this mixin.

server

This is a helper for POE::Declarative. It prefixes "server_" to the name of your POE states. For example:

on server startup => run { ... };

is the same as:

on server_startup => run { ... };

It can also be used to yield messages:

yield server 'startup'; # probably shouldn't actually do that

You may choose to use it or not.

setup

Setup the server and call all the mixin setup methods.

default_configuration PACKAGE

Returns a base configuration appropriate for all servers.

SERVER STATES

These are additional states your server (or server mixin) may choose to implement that are provided to your server.

on server startup

This is yielded at the end of the "on _start" handler for the POE session. Your server should perform any initialization needed here.

on server quit

A server should emit this state when it wants the server to disconnect and shutdown. If all mixins are implemented correctly, they should listen for this state and close all resources, which should result in the server going into the "on _stop" state and exiting shortly after emitting this state. (If they are not, the server might just be stuck alive and have to be killed externally.)

This should be used by protocol mixins to implement the shutdown sequence for their listening ports, open files, etc.

on server shutdown

This is called synchronously at the end of the "on _stop" handler for the POE session.

POE STATES

on _start

Handles session startup. At startup, it loads the information stored in the configuration file and then fires "on server startup".

on _default ARG0 .. ARGN

Performs logging for the general messages that are not handled by the system.

on _stop

This calls (synchronously) the "on server shutdown" state, to handle any final clean up before quitting.

SEE ALSO

Bot::Net::Mixin::Server::IRC

AUTHORS

Andrew Sterling Hanenkamp <hanenkamp@cpan.org>

COPYRIGHT AND LICENSE

Copyright 2007 Boomer Consulting, Inc. All Rights Reserved.

This program is free software and may be modified and distributed under the same terms as Perl itself.