Fix for parsing config files with empty values

Thanks to Stefan Steiner
This commit is contained in:
Duncan Ferguson 2010-12-03 14:18:05 +00:00
parent 5de65fbf77
commit 69a51ae54c
4 changed files with 13 additions and 5 deletions

View file

@ -1,3 +1,6 @@
????-??-?? Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_07
* Fix for parsing config files with empty values (Stefan Steiner)
2010-09-20 Duncan Ferguson <duncan_ferguson@user.sf.net> - v4.00_06
* Fix test error on 5.8.8 (reported by Wei Wang)
* Added '--list', '-L' to list available cluster tags (idea from Markus Manzke)

View file

@ -17,7 +17,7 @@ name: App-ClusterSSH
provides:
App::ClusterSSH:
file: lib/App/ClusterSSH.pm
version: 4.00_06
version: 4.00_07
App::ClusterSSH::Base:
file: lib/App/ClusterSSH/Base.pm
version: 0.02
@ -40,4 +40,4 @@ resources:
repository:
- http://clusterssh.git.sourceforge.net/
- http://github.com/duncs/clusterssh
version: 4.00_06
version: 4.00_07

1
THANKS
View file

@ -37,3 +37,4 @@ Roland Rosenfeld
Wei Wang
Markus Manzke
Simon Fraser
Stefan Steiner

View file

@ -3,7 +3,7 @@ package App::ClusterSSH;
use 5.008.004;
use warnings;
use strict;
use version; our $VERSION = version->new('4.00_06');
use version; our $VERSION = version->new('4.00_07');
use Carp;
@ -269,6 +269,8 @@ sub parse_config_file($) {
; # ignore blank lines & commented lines
$l =~ s/#.*//; # remove comments from remaining lines
$l =~ s/\s*$//; # remove trailing whitespace
# look for continuation lines
chomp $l;
if ( $l =~ s/\\\s*$// ) {
$l .= <CFG>;
@ -277,8 +279,10 @@ sub parse_config_file($) {
next unless $l =~ m/\s*(\S+)\s*=\s*(.*)\s*/;
my ( $key, $value ) = ( $1, $2 );
$config{$key} = $value;
logmsg( 3, "$key=$value" );
if ( defined $key && defined $value ) {
$config{$key} = $value;
logmsg( 3, "$key=$value" );
}
}
close(CFG);