aboutsummaryrefslogtreecommitdiff
path: root/Plugin.pm
diff options
context:
space:
mode:
authorDavid Phillips <david@yeah.nah.nz>2018-11-03 23:18:34 +1300
committerDavid Phillips <david@yeah.nah.nz>2018-11-03 23:24:12 +1300
commitf598474aeb237e18b90720797bcc274e4675dddb (patch)
treecb920647fffa97d5c1e1e71925f9c6fb561cc645 /Plugin.pm
parentdf66c56970b5cc571855f2a8615648775cf938e7 (diff)
downloadidalius-f598474aeb237e18b90720797bcc274e4675dddb.tar.xz
Add sanity check to plugin loading
Diffstat (limited to 'Plugin.pm')
-rw-r--r--Plugin.pm8
1 files changed, 7 insertions, 1 deletions
diff --git a/Plugin.pm b/Plugin.pm
index 1f3d080..6714987 100644
--- a/Plugin.pm
+++ b/Plugin.pm
@@ -17,12 +17,18 @@ sub load_plugin {
eval {
require $path . ".pm";
- push @{$config->{active_plugins}}, $module;
} or do {
chomp $@;
$logger->($@);
return "Cannot load $module: $!";
};
+
+ if (not $module->can("configure")) {
+ $logger->("Loaded $module but it can't be configured. Probably not a module for us");
+ return "Can't configure $module. It probably isn't a module for me. Unloaded it.";
+ }
+
+ push @{$config->{active_plugins}}, $module;
$load_callback->($module);
return undef;
}