App::Modular::Module::Events is a Perl module with event handling for App::Modular compatible applications.
SYNOPSIS
package App::Modular::Module::Me;
use base qw(App::Modular::Module);
sub depends { return 'Events'; }
sub start_listen {
my $self = shift;
$self->{'modularizer'}->module('Events')->
register('Listener', 'TelephoneRings');
};
sub event_handler {
my $self = shift;
my $event = shift;
print 'Yeah! Somebody thought about me!'
if ($event eq 'TelephoneRings');
};
package App::Modular::Module::You;
use base qw(App::Modular::Module);
sub depends { return 'Events'; }
sub call_me {
$self->{'modularizer'}->module('Events')->
trigger('TelephoneRings');
};
package main;
use App::Modular;
my $modul = instance App::Modular;
$modul->module('Me')->start_listen();
$modul->module('You')->callme();
exit;
App::Modular aims to provide a framework which should it make very easy to programmes to create any kind of modular program.
This module provides basic event handling as a contribution to that toolkit. Modules may register themselves as listeners for events, if an event is triggered, all the modules are notified by calling $module-event_handler('event', @params) >.
The events are speciefied as simple strings.
Product's homepage
Requirements:
· Perl