Subject: | Patch to eliminate uninitialized value warning. |
This patch eliminates the following warning:
Use of uninitialized value in array dereference at
/usr/lib/perl5/site_perl/5.8.8/Nagios/Object.pm line 1059
I also noticed the same problem reported in bug #43890, but I used a
slightly different method to fix it which I think is better. The patch
in that bug report does a lot of unnecessary anonymous reference
creation and dereferencing, while the patch I created just does a simple
defined test before assignment.
~Jason
Subject: | perl-Nagios-Object-warning.patch |
diff -uNr Nagios-Object-0.21.3-dist/lib/Nagios/Object.pm Nagios-Object-0.21.3/lib/Nagios/Object.pm
--- Nagios-Object-0.21.3-dist/lib/Nagios/Object.pm 2009-02-20 11:30:34.000000000 -0500
+++ Nagios-Object-0.21.3/lib/Nagios/Object.pm 2009-05-28 10:49:12.000000000 -0400
@@ -1056,7 +1056,7 @@
}
# also, before resolution, append to the list rather than replace it
else {
- @members = @{ $self->{members} };
+ @members = @{ $self->{members} } if $self->{members};
foreach my $item ( @_ ) {
if ( ref($item) eq 'ARRAY' && @$item == 2 ) {
push @members, $item;