From 8ff9ba40fcbfc00260466509c4cbb95d43f8b682 Mon Sep 17 00:00:00 2001 From: William Heimbigner Date: Thu, 14 Jan 2016 14:50:40 -0700 Subject: Register command-processing handlers inside of the command module, rather than having the event handler module call the command handler module --- lib/ASM/Commander.pm | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'lib/ASM/Commander.pm') diff --git a/lib/ASM/Commander.pm b/lib/ASM/Commander.pm index 054c57c..f53781f 100644 --- a/lib/ASM/Commander.pm +++ b/lib/ASM/Commander.pm @@ -142,9 +142,13 @@ my $cmdtbl = { sub new { my $module = shift; + my ($conn) = @_; my $self = {}; $self->{cmdtbl} = $cmdtbl; + $self->{CONN} = $conn; bless($self); + $conn->add_handler('msg', sub { command($self, @_); }, "after"); + $conn->add_handler('public', sub { command($self, @_); }, "after"); return $self; } -- cgit v1.2.3