Skip to content

Commit

Permalink
Don't leave a trailing space for blank values
Browse files Browse the repository at this point in the history
  • Loading branch information
rwstauner committed Mar 21, 2013
1 parent c17fcdf commit 81d8ec0
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
2 changes: 2 additions & 0 deletions Changes
Expand Up @@ -2,6 +2,8 @@ Revision history for Config-MVP-Writer-INI

{{$NEXT}}

- Don't leave a trailing space on a line where a config value is blank

0.002 2013-03-04T00:45:53Z

- Document and test the 'spacing' and 'rewrite_package' options
Expand Down
4 changes: 3 additions & 1 deletion lib/Config/MVP/Writer/INI.pm
Expand Up @@ -131,8 +131,10 @@ sub _ini_section_config {

foreach my $k ( sort keys %$config ){
my $v = $config->{ $k };
$v = '' if !defined $v;
push @lines,
map { sprintf "%-*s = %s\n", $len, $k, $_ }
# don't end a line with "=\x20" (when the value is '')
map { sprintf "%-*s =%s\n", $len, $k, (length($_) ? ' ' . $_ : '') }
# one k=v line per array item
ref $v eq 'ARRAY'
? @$v
Expand Down

0 comments on commit 81d8ec0

Please sign in to comment.