Base code for using plugins.
This commit is contained in:
parent
a42d6e91dd
commit
87dcfb587f
@ -47,6 +47,21 @@ sub new {
|
|||||||
# whitelist
|
# whitelist
|
||||||
$Self->{Whitelist} = $Param{Whitelist};
|
$Self->{Whitelist} = $Param{Whitelist};
|
||||||
|
|
||||||
|
# include plugins
|
||||||
|
my @Plugins = glob("$FindBin::Bin/Plugins/*");
|
||||||
|
if ( @Plugins ) {
|
||||||
|
use File::Basename;
|
||||||
|
PLUGIN:
|
||||||
|
for my $PluginPath ( @Plugins ) {
|
||||||
|
my $PluginName = basename($PluginPath);
|
||||||
|
my $PluginObject = require("$FindBin::Bin/Plugins/${PluginName}/Core.pm");
|
||||||
|
if( !$PluginObject ) {
|
||||||
|
$Self->{LogObject}->error("Couldn't load plugin $PluginName");
|
||||||
|
next PLUGIN;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return $Self;
|
return $Self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user