diff options
author | David Phillips <david@yeah.nah.nz> | 2018-11-03 23:18:34 +1300 |
---|---|---|
committer | David Phillips <david@yeah.nah.nz> | 2018-11-03 23:24:12 +1300 |
commit | f598474aeb237e18b90720797bcc274e4675dddb (patch) | |
tree | cb920647fffa97d5c1e1e71925f9c6fb561cc645 /Plugin.pm | |
parent | df66c56970b5cc571855f2a8615648775cf938e7 (diff) | |
download | idalius-f598474aeb237e18b90720797bcc274e4675dddb.tar.xz |
Add sanity check to plugin loading
Diffstat (limited to 'Plugin.pm')
-rw-r--r-- | Plugin.pm | 8 |
1 files changed, 7 insertions, 1 deletions
@@ -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; } |