From 46b032f1b6a46ca8fe266eb257d8f9efb9207f6c Mon Sep 17 00:00:00 2001 From: Thomas von Dein Date: Sat, 10 Oct 2009 16:30:35 +0000 Subject: [PATCH] 2.27 - bugfix in _store, which caused warning when saving a config containing empty hashes. Reported by herbert breunung . - removed applied patch (added in 2.20), there are no more calls to binmode(), this destroys portability, because perls determines itself wether it uses \n or \r\n as newline. Reported by herbert breunung too. - applied patch by Danial Pearce , scalars containing a backslash as the last character will be written out as here-doc when storing a config to disk. git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@53 be1acefe-a474-0410-9a34-9b3221f2030f --- Changelog | 15 +++++++++++++++ General.pm | 9 ++++----- README | 2 +- 3 files changed, 20 insertions(+), 6 deletions(-) diff --git a/Changelog b/Changelog index 2356315..1787faf 100644 --- a/Changelog +++ b/Changelog @@ -1,3 +1,18 @@ + 2.27 + - bugfix in _store, which caused warning when saving + a config containing empty hashes. Reported by + herbert breunung . + + - removed applied patch (added in 2.20), there are no more + calls to binmode(), this destroys portability, because + perls determines itself wether it uses \n or \r\n as newline. + Reported by herbert breunung too. + + - applied patch by Danial Pearce , + scalars containing a backslash as the last character will + be written out as here-doc when storing a config to disk. + + 2.26 - fixed invalid regexp in _open() which circumvented explicit empty block to work when the block statement diff --git a/General.pm b/General.pm index 62e6194..7ccbfaa 100644 --- a/General.pm +++ b/General.pm @@ -18,7 +18,7 @@ use strict; use Carp; use Exporter; -$Config::General::VERSION = "2.26"; +$Config::General::VERSION = "2.27"; use vars qw(@ISA @EXPORT); @ISA = qw(Exporter); @@ -324,7 +324,6 @@ sub _open { if (-e $configfile) { open $fh, "<$configfile" or croak "Could not open $configfile!($!)\n"; - binmode($fh); $this->_read($fh); } else { @@ -891,7 +890,7 @@ sub _store { local $_; my $indent = " " x $level; - my $config_string; + my $config_string = ""; foreach my $entry (sort keys %config) { if (ref($config{$entry}) eq "ARRAY") { @@ -927,7 +926,7 @@ sub _write_scalar { my $config_string; - if ($line =~ /\n/) { + if ($line =~ /\n/ || $line =~ /\\$/) { # it is a here doc my $delimiter; my $tmplimiter = "EOF"; @@ -1986,7 +1985,7 @@ Thomas Linden =head1 VERSION -2.26 +2.27 =cut diff --git a/README b/README index f360ccc..229646c 100644 --- a/README +++ b/README @@ -104,4 +104,4 @@ AUTHOR VERSION - 2.26 + 2.27