Skip to content

Commit

Permalink
Allow hooks to return a value.
Browse files Browse the repository at this point in the history
  • Loading branch information
jamiemccarthy committed Apr 8, 2005
1 parent b49f91b commit 3099db1
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Slash/Hook/Hook.pm
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ sub slashHook {
my($param, $options) = @_;
my $slashdb = getCurrentDB();

my $retval = undef;
my $hooks = $slashdb->getHooksByParam($param);
for my $hook (@$hooks) {
my $class = $hook->{class};
Expand Down Expand Up @@ -52,13 +53,16 @@ sub slashHook {
$code = \&{ $function };
}
if (defined (&$code)) {
unless ($code->($options)) {
$retval = $code->($options);
if (!$retval) {
errorLog("Failed executing hook ($param) - $function");
}
} else {
errorLog("Failed trying to do hook ($param) - $function");
}
}

$retval;
}

1;
Expand Down

0 comments on commit 3099db1

Please sign in to comment.