mirror of
https://github.com/pragma-/pbot.git
synced 2025-01-11 20:42:38 +01:00
Unregister timers by id instead of subref
This commit is contained in:
parent
6e4c7853f2
commit
4c5227b351
@ -164,17 +164,15 @@ sub register {
|
|||||||
|
|
||||||
sub unregister {
|
sub unregister {
|
||||||
my $self = shift;
|
my $self = shift;
|
||||||
my $ref;
|
my $id;
|
||||||
|
|
||||||
if(@_) {
|
if(@_) {
|
||||||
$ref = shift;
|
$id = shift;
|
||||||
} else {
|
} 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 { $_->{id} ne $id } @{ $self->{handlers} };
|
||||||
|
|
||||||
@{ $self->{handlers} } = grep { $_->{subref} != $ref } @{ $self->{handlers} };
|
|
||||||
}
|
}
|
||||||
|
|
||||||
sub update_interval {
|
sub update_interval {
|
||||||
|
Loading…
Reference in New Issue
Block a user