]> ruin.nu Git - NDIRC.git/blobdiff - Dispatcher.pm
Basic conversion to POE::Component::IRC
[NDIRC.git] / Dispatcher.pm
index 5da34bdaf5d9ab976419ff8151ceda3275462261..8d7ffe9843893ba2768cced2fd149a8becec64c5 100644 (file)
@@ -67,7 +67,7 @@ sub load_class {
        my @subs = eval "$class->meta->get_method_list";
        for my $c (@subs){
                my $attr = eval "$class->meta->get_method('$c')->attributes";
-               if ($attr){
+               if (@$attr){
                        print "Command: $c";
                        my %c = (channels => ['all']);
                        my @aliases;
@@ -110,7 +110,7 @@ sub has_command {
        my ($self,$command,$channel) = @_;
        $channel = lc $channel;
 
-       return 0 unless exists $self->commands->{$command};
+       return 0 unless defined $command && exists $self->commands->{$command};
 
        my $types = Set::Object->new(@{$self->commands->{$command}->type});
        my @types = qw/pub/;
@@ -146,6 +146,7 @@ sub run_command {
                        }
                }
        }
+       return 1;
 }
 
 1;