mirror of
https://github.com/pragma-/pbot.git
synced 2024-11-20 02:49:49 +01:00
Registerable: add register_front method to register to head of list
This commit is contained in:
parent
c9be31a9c0
commit
52f183deae
@ -54,6 +54,14 @@ sub register {
|
|||||||
return $ref;
|
return $ref;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
sub register_front {
|
||||||
|
my ($self, $subref) = @_;
|
||||||
|
Carp::croak("Must pass subroutine reference to register_front()") if not defined $subref;
|
||||||
|
my $ref = {subref => $subref};
|
||||||
|
unshift @{$self->{handlers}}, $ref;
|
||||||
|
return $ref;
|
||||||
|
}
|
||||||
|
|
||||||
sub unregister {
|
sub unregister {
|
||||||
my ($self, $ref) = @_;
|
my ($self, $ref) = @_;
|
||||||
Carp::croak("Must pass reference to unregister()") if not defined $ref;
|
Carp::croak("Must pass reference to unregister()") if not defined $ref;
|
||||||
|
Loading…
Reference in New Issue
Block a user