=head1 NAME NACL::Events::Branch - Base branch event class for all NACL events =head1 DESCRIPTION C event class can be used for subscribing to all NACL events that are stemmed from this event class.This event class can be used only for subscribing not for publishing any events. This library extends the functionality of C =head1 SYNOPSIS The following example will illustrate on how to subscribe to all NACL events use NATE::Log qw(log_global); use NATE::Events qw(eventloop_drain); use NACL::Events; my $event = NACL::Events::Branch->new(); # subscribe to all NACL events and execute the callback when it occurs my $listener = $event->subscribe(listener => { callback => \&event_handler, flag => 0 }); sub event_handler { my $msg_obj = shift; my $local_listener = shift; if ($msg_obj->topic() eq "NACL::Events::Foo::create") { log_global()->comment("An element Foo was created"); } elsif ($msg_obj->topic() eq "NACL::Events::Foo::delete") { log_global()->comment("An element Foo was deleted"); # update the flag on the listener hash reference to break the eventloop_drain $local_listener->{flag} = 1; } elsif { .. } .. } while (!$listener->{flag}) { # do other things in the mean time ... eventloop_drain(); } =cut package NACL::Events::Branch; # inherit all methods from NATE::Events::Branch use parent qw(NATE::Events::Branch); 1;