NAME

Labrador::Dispatcher::Events

SYNOPSIS

	use Labrador::Dispatcher::Events;

DESCRIPTION

Called by Connections.pm on occurrence of certain events occurring. Instantiates the Command handler, which callsback to register it's interest in different commands. The Event handler can then dispatch Commands invocations straight to the correct method in the Command handler. Cute, eh?

METHODS

new($config)

Instantitate the object. Pass a reference to a Labrador::Common::Config instance to the constructor.

init()

Initialises the object to it's initial state, including instantiating a Command handler. Called by the constructor.

register_command($verb, $command_code, [$privileged])

Called by the Commands handler (Commands.pm) to register it's interest in $verb, with a code reference to call when the command is invoked by a client. The privilege level of this command is optionally included (default 1). Current privilege states are TODO

client_disconnect($client)

EVENTS

Events are an interface supplied to the networking code, that allows it to inform the rest of the dispatcher of network level events occurring. These include verb command requests, connections and disconnections.

event_command
event_connect($client)

Called when a client connects.

event_disconnect($client)

This event occurs if a client is unexpectedly disconnected - in normal situations, the dispatcher should disconnect the client, not vice-versa.

event_idle

Event occurs if Connections.pm is bored, has nothing to do and wishes to give up some processing time to us.

NB: The quicker this method returns, the quicker Connections.pm can get back to processing client requests. Don't be too long in here!

CVS

	$Revision: 1.9 $