NAME
Konstrukt::Event - Event management
SYNOPSIS
#Register for an event:
#register an object method:
$Konstrukt::Event->register("eventname", $object, \&sub_reference);
#note that duplicate entries will be ignored
#deregister from an event:
#only deregister this method from the specified event:
$Konstrukt::Event->deregister("eventname", $object, \&sub_reference);
#deregister all registered method for a specified object:
$Konstrukt::Event->deregister_all_by_object("eventname", $object);
#fire an event:
#the optional arguments will be passed to the registered methods
$Konstrukt::Event->trigger("eventname"[, arg1[, arg2[, ...]]]);
DESCRIPTION
This module provides event handling within the Konstrukt framework. You may register object methods for events and you may also fire events, on which the registered methods are called. This will help synchonizing some parts/plugins of the framework without glueing them together too tightly.
For a detailed description of the usage of this module see "SYNOPSIS"
METHODS
new
Constructor of this class
init
Initialization of this class
register
Registers an object method for a specified event
Parameters:
$eventname - The name of the event.
$objectref - Reference to the object, whose method should be called
$methodref - Reference to the method, which should be called
deregister
Deregisters an object method for a specified event
Parameters:
$eventname - The name of the event.
$objectref - Reference to the object, whose method should be deregistered
$methodref - Reference to the method, which should be deregistered
deregister_all_by_object
Deregisters all registered methods of an object from a specified event
Parameters:
$eventname - The name of the event.
$objectref - Reference to the object, whose method should be deregistered
trigger
Triggers an event with the specified name and the passed arguments.
Parameters:
$eventname - The name of the event.
($arg1, $arg2, ...) - Optional: Arguments that should be passed to the methods
AUTHOR
Copyright 2006 Thomas Wittek (mail at gedankenkonstrukt dot de). All rights reserved.
This document is free software. It is distributed under the same terms as Perl itself.