Skip to content

Instantly share code, notes, and snippets.

Avatar

geoffreybennett

View GitHub Profile
View gist:b5b3b673c309e886824361d4f4d62a00
--- PubSub.pm.orig 2018-11-07 22:09:03.636066615 +1030
+++ PubSub.pm 2018-11-07 22:21:28.613982320 +1030
@@ -29,8 +29,12 @@
sub unlisten {
my ($self, $name, $cb) = @_;
my $chan = $self->{chans}{$name};
+ my $unlisten = $cb ? grep { $cb eq $_ } @$chan : 1;
@$chan = $cb ? grep { $cb ne $_ } @$chan : ();
- $self->_db->unlisten($name) and delete $self->{chans}{$name} unless @$chan;
+ if (!@$chan) {
You can’t perform that action at this time.