3
0
mirror of https://github.com/pragma-/pbot.git synced 2025-01-11 20:42:38 +01:00

EventDispatcher: clarify purpose of dispatch_event return value

This commit is contained in:
Pragmatic Software 2021-07-06 18:55:14 -07:00
parent 036e06dce8
commit 098734c946

View File

@ -90,8 +90,11 @@ sub dispatch_event {
# invoke event handler
my $handler_result = eval { $subref->($event_name, $event_data) };
# update $dispatch_result only to a true handler result
$dispatch_result = $handler_result if not $dispatch_result;
# update $dispatch_result only to a defined handler result because
# we want to know if at least one handler handled the event. the
# value of $dispatch_result will be undef if NONE of the handlers
# have kicked in.
$dispatch_result = $handler_result if defined $handler_result;
# check for error
if (my $error = $@) {