# -------------------------------------------------------- # Build the environment var. for the plugins # -------------------------------------------------------- my $environment = { 'parser_conf' => $conf, 'vars_conf' => $vars }; # Stage, environment hash, config object runPlugin('2',$environment,$plugin_config); #### # --------------------------------------------------------- # runPlugin # ~~~~~~~~~ # Runs a plugin at a given stage of the content engine # phase. Expects the stage, # the environment and the plugin configuration as # parameters. # --------------------------------------------------------- sub runPlugin { my $setting = shift; my $environment = shift; my $plugin_config = shift; return unless defined $setting; return unless defined $environment; return unless defined $plugin_config; if(defined($plugin_config->setting($setting))) { # We have a winner my $module = $plugin_config->setting($setting); $module =~ s/\.(pm|PM)$//; eval{ # Import - create object - run code my $mainmodule = "Plugins/Core/" .$module . ".pm"; require $mainmodule; import $mainmodule; my $obj = $module->new(); $obj->run( $environment ); $obj->closedown(); }; if($@) { # Log this or something } } }