Permalink
Browse files

Use Module::Load, fixes in plugins

  • Loading branch information...
tadzik committed May 21, 2010
1 parent 0172478 commit 370da12f2b8feb709f7ec7689f924d25209adb1d
Showing with 11 additions and 10 deletions.
  1. +0 −2 README
  2. +1 −1 a8bot.pm
  3. +2 −1 a8bot/Plugin.pm
  4. +1 −0 plugins/Ping.pm
  5. +5 −1 plugins/Powiedz.pm
  6. +2 −5 plugins/WebTitle.pm
View
2 README
@@ -1,5 +1,3 @@
-Needs Perl compiled with threads
-
Required modules:
Moose
MooseX::NonMoose
View
@@ -83,7 +83,7 @@ sub BUILD {
}
},
error => sub {
- my ($code, $message, $ircmsg) = @_;
+ my (undef, $code, $message, $ircmsg) = @_;
$self->log("Error $code: $message");
},
publicmsg => sub {
View
@@ -1,6 +1,7 @@
package a8bot::Plugin;
use feature ':5.10';
use lib 'plugins';
+use Module::Load;
use Moose;
has 'bot' => (
@@ -48,7 +49,7 @@ has '_registered' => (
sub BUILD {
my $self = shift;
- require $self->plugin . '.pm';
+ load $self->plugin;
my $events = $self->plugin->init;
$self->_disconnect($events->{disconnect} // sub {});
$self->_publicmsg($events->{publicmsg} // sub {});
View
@@ -13,6 +13,7 @@ sub pubmsg {
if ($data->{msg} =~ /^$bot->{nick}:?,? ping$/) {
return [PRIVMSG => $data->{channel}, "$data->{nick}: pong"];
}
+ return undef;
}
1;
View
@@ -26,7 +26,11 @@ sub pubmsg {
}
$db->remove($data->{nick});
}
- return $resp;
+ if ($resp ne '') {
+ return $resp;
+ } else {
+ return undef;
+ }
}
1;
View
@@ -11,12 +11,9 @@ sub pubmsg {
$ua->max_size(1024);
my $site = get($1);
my ($title) = $site =~ /<title>([^<]+)<\/title>/;
- if ($title) {
- return "[ $title ]";
- } else {
- return undef;
- }
+ return "[ $title ]" if $title;
}
+ return undef;
}
1;

0 comments on commit 370da12

Please sign in to comment.