From f3dc434535cd36a09a7939d066a579c90991fb57 Mon Sep 17 00:00:00 2001 From: Rich Megginson Date: Mon, 27 Jun 2011 10:51:38 -0600 Subject: [PATCH 3/3] writing Inf file shows SchemaFile = ARRAY(0xhexnum) The Inf file writer was not handling perl arrays correctly - it was just doing a string conversion, which by default just prints the internal perl address. The solution is to write each array element as a separate directive. Also removed extra newlines. --- ldap/admin/src/scripts/Inf.pm | 18 ++++++++++++------ 1 files changed, 12 insertions(+), 6 deletions(-) diff --git a/ldap/admin/src/scripts/Inf.pm b/ldap/admin/src/scripts/Inf.pm index a102eb6..d0e5b79 100644 --- a/ldap/admin/src/scripts/Inf.pm +++ b/ldap/admin/src/scripts/Inf.pm @@ -168,10 +168,18 @@ sub writeSection { if (ref($section) eq 'HASH') { print $fh "[$name]\n"; for my $key (sort keys %{$section}) { - if (defined($section->{$key})) { - my $val = $section->{$key}; - $val =~ s/\n/\\\n/g; # make continuation lines - print $fh "$key = $val\n"; + if (exists($section->{$key}) and defined($section->{$key}) and + (length($section->{$key}) > 0)) { + my @vals = (); + if (ref($section->{$key})) { + @vals = @{$section->{$key}}; + } else { + @vals = ($section->{$key}); + } + for my $val (@vals) { + $val =~ s/\n/\\\n/g; # make continuation lines + print $fh "$key = $val\n"; + } } } } @@ -216,11 +224,9 @@ sub write { } # write General section first $self->writeSection('General', $fh); - print $fh "\n"; for my $key (keys %{$self}) { next if ($key eq 'General'); $self->writeSection($key, $fh); - print $fh "\n"; } close $fh; umask($savemask); -- 1.7.1