Unverified Commit 1e03bf82 authored by Stefan Hornburg (Racke)'s avatar Stefan Hornburg (Racke)
Browse files

Prevent Sympa daemon crash due to a broken plugin module.

parent fe59ff55
...@@ -95,6 +95,9 @@ requires 'List::Util::XS', '>= 1.20'; ...@@ -95,6 +95,9 @@ requires 'List::Util::XS', '>= 1.20';
# Note: 1.22 or later is recommended. # Note: 1.22 or later is recommended.
requires 'Locale::Messages', '>= 1.20'; requires 'Locale::Messages', '>= 1.20';
# Used to load plugins
requires 'Module::Runtime';
# MHonArc is used to build Sympa web archives # MHonArc is used to build Sympa web archives
requires 'MHonArc::UTF8'; requires 'MHonArc::UTF8';
......
...@@ -30,6 +30,7 @@ package Sympa::Message::Plugin; ...@@ -30,6 +30,7 @@ package Sympa::Message::Plugin;
use strict; use strict;
use warnings; use warnings;
use English qw(-no_match_vars); use English qw(-no_match_vars);
use Module::Runtime qw(use_module);
use Sympa::Log; use Sympa::Log;
...@@ -58,8 +59,7 @@ sub execute { ...@@ -58,8 +59,7 @@ sub execute {
unless $hook_module =~ /::/; unless $hook_module =~ /::/;
unless (exists $handlers{$hook_module . '->' . $hook_name}) { unless (exists $handlers{$hook_module . '->' . $hook_name}) {
eval "use $hook_module;"; unless (eval { use_module($hook_module); 1; }) {
if ($EVAL_ERROR) {
$log->syslog('err', 'Cannot load hook module %s: %s', $log->syslog('err', 'Cannot load hook module %s: %s',
$hook_module, $EVAL_ERROR); $hook_module, $EVAL_ERROR);
return undef; return undef;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment