3
0
mirror of https://github.com/pragma-/pbot.git synced 2024-12-24 11:42:35 +01:00

Unregister timers by id instead of subref

This commit is contained in:
Pragmatic Software 2016-01-29 12:59:07 -08:00
parent 6e4c7853f2
commit 4c5227b351

View File

@ -164,17 +164,15 @@ sub register {
sub unregister {
my $self = shift;
my $ref;
my $id;
if(@_) {
$ref = shift;
$id = shift;
} else {
Carp::croak("Must pass subroutine reference to unregister()");
Carp::croak("Must pass timer id to unregister()");
}
# print "-- Removing timer $ref\n";
@{ $self->{handlers} } = grep { $_->{subref} != $ref } @{ $self->{handlers} };
@{ $self->{handlers} } = grep { $_->{id} ne $id } @{ $self->{handlers} };
}
sub update_interval {