From 5e4535e7e7be7fa62df9a88286981d49e997ea10 Mon Sep 17 00:00:00 2001 From: Sergey Poznyakoff Date: Thu, 8 Jun 2023 16:53:10 +0000 Subject: [PATCH] Minor fix * lib/Nagios/Template.pm: Provide explicit DESTROY method. --- lib/Nagios/Template.pm | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/lib/Nagios/Template.pm b/lib/Nagios/Template.pm index bfe74bb..a70b79a 100644 --- a/lib/Nagios/Template.pm +++ b/lib/Nagios/Template.pm @@ -17,7 +17,7 @@ sub can { return $s; } foreach my $obj ($self->objects) { - if ($obj->can($meth)) { + if (defined($obj) && $obj->can($meth)) { return $obj; } } @@ -30,7 +30,7 @@ sub AUTOLOAD { my ($p, $m) = ($1, $2); my $has_attr; foreach my $obj ($self->objects) { - if ($obj->can($m)) { + if (defined($obj) && $obj->can($m)) { $has_attr = 1; if (defined(my $v = $obj->${\$m}(@_))) { return $v; @@ -41,6 +41,8 @@ sub AUTOLOAD { croak "Can't locate object method \"$m\" via package \"$p\""; } +sub DESTROY {} + 1; =head1 NAME