Added an optional @args onto event_run() for sending @args to the subs that have hooked onto the event.
This commit is contained in:
1 parent
3afdcfd374
commit
e0ad8bd911
2 files changed
+9
-2
No files matched your search
@@ -3,6 +3,8 @@ Auto IRC Bot 3.0: Change Log
|
||||
|
||||
3.0 Indev
|
||||
==================================================================
|
||||
* Added an optional @args onto event_run() for sending @args
|
||||
to the subs that have hooked onto the event.
|
||||
* Parse the channels the bot is in.
|
||||
* Parse Numeric:438.
|
||||
* Added timer_add() and timer_del() to API::Std for timers.
|
||||
|
||||
+7
-2
@@ -135,11 +135,16 @@ sub event_del
|
||||
# Trigger an event.
|
||||
sub event_run
|
||||
{
|
||||
my ($event) = @_;
|
||||
my ($event, @args) = @_;
|
||||
|
||||
if (defined $EVENTS{lc($event)} and defined $HOOKS{lc($event)}) {
|
||||
foreach my $hk (keys %{ $HOOKS{lc($event)} }) {
|
||||
&{ $HOOKS{lc($event)}{$hk} }();
|
||||
if (defined @args) {
|
||||
&{ $HOOKS{lc($event)}{$hk} }(@args);
|
||||
}
|
||||
else {
|
||||
&{ $HOOKS{lc($event)}{$hk} }();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user