From c02e72eb71c1682f9bdd6582b7bd9fbe49b167f5 Mon Sep 17 00:00:00 2001 From: garnier-quentin Date: Fri, 28 Aug 2015 16:08:52 +0200 Subject: [PATCH] + add some explanation --- centreon/plugins/script.pm | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/centreon/plugins/script.pm b/centreon/plugins/script.pm index b13c3a0e8..81df96169 100644 --- a/centreon/plugins/script.pm +++ b/centreon/plugins/script.pm @@ -40,10 +40,19 @@ sub new { $self->{plugin} = undef; $self->{help} = undef; + # Avoid to destroy because it keeps a ref on the object. + # A problem if we execute it multiple times in the same perl execution + # Use prepare_destroy $self->set_signal_handlers; return $self; } +sub prepare_destroy { + my $self = shift; + + delete $handlers{DIE}->{$self}; +} + sub set_signal_handlers { my $self = shift;