Subject: | Patch for attributes containing a list of values. |
I think this may be the same problem reported in bug #31291, but I don't
think that is the correct way to fix the problem. Instead of commenting
out the split in the original parsing set attribute function, I made a
patch for the register function that doesn't try to split an array ref
that was already split earlier.
~Jason
Subject: | perl-Nagios-Object-Config-broken_list_attributes.patch |
diff -uNr Nagios-Object-0.21.3-dist/lib/Nagios/Object/Config.pm Nagios-Object-0.21.3/lib/Nagios/Object/Config.pm
--- Nagios-Object-0.21.3-dist/lib/Nagios/Object/Config.pm 2009-02-20 11:30:34.000000000 -0500
+++ Nagios-Object-0.21.3/lib/Nagios/Object/Config.pm 2009-05-28 16:06:49.000000000 -0400
@@ -531,7 +536,15 @@
my( $self, $object, $attribute, $attr_type ) = @_;
# split on comma surrounded by whitespace or by just whitespace
- my @to_find = split /\s*,\s*|\s+/, $object->$attribute();
+ # - don't try splitting it if it has already been split by the Nagios::Object::_set function!
+ # - same bug reported in CPAN's RT: http://rt.cpan.org/Public/Bug/Display.html?id=31291
+ my @to_find;
+ my $value = $object->$attribute();
+ if (ref $value eq 'ARRAY') {
+ @to_find = @{ $value };
+ } else {
+ @to_find = split /\s*,\s*|\s+/, $value;
+ }
my @found = ();
# handle splat '*' matching of all objects of a type (optimization)