events.rb

Path: lib/mues/events.rb  (CVS)
Last Update: Sat Aug 18 22:54:10 -0700 2007

This module is a collection of event classes for system-level (as opposed to environment-level) events, and a mixin which provides default methods for objects which wish to be event handlers.

Synopsis

  require 'mues/events'
  require 'mues/mixins'

  include MUES::Event::Handler
  include MUES::ServerFunctions

  event = MUES::EngineShutdownEvent::new
  event.priority = MUES::Event::MaxPriority
  dispatchEvent( event )

Mixins

MUES::Event::Handler
A default event handler mixin. Including this module mixes in a handleEvent method that does dynamic dispatch to methods in the class that mixes it in. It will look for a method called handleEventClass(), where eventClass is the class of the event to handle. If no explicit handler is found, each of the event^s superclasses is tried as well. If no handler is defined for any of the events, it tries to call handleEvent(). If no handler is found, a MUES::UnhandledEventError is raised.

To Do

  • Work priority into the class heirarchy so you can optionally pass a priority to the constructor of any subclass.

Subversion ID

$Id: events.rb 1206 2004-05-09 21:25:11Z deveiant $

Authors

  • Michael Granger <ged@FaerieMUD.org>

Copyright

Copyright (c) 2000-2003 The FaerieMUD Consortium. All rights reserved.

This module is free software. You may use, modify, and/or redistribute this software under the terms of the Perl Artistic License. (See language.perl.com/misc/Artistic.html)

THIS PACKAGE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTIES OF MERCHANTIBILITY AND FITNESS FOR A PARTICULAR PURPOSE.

Required files

mues/events/event   mues/events/privilegedevent   mues/events/ioevents   mues/events/loginevents   mues/events/userevents   mues/events/systemevents   mues/events/environmentevents   mues/events/serviceevents   mues/events/commandevents  

[Validate]