1.35 - the here-doc identifier in saved configs will now created

in a way which avoids the existence of this identifier
	   inside the here-doc, which if it happens results in
           weird behavior in the resulting config.


git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@24 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
Thomas von Dein
2009-10-10 16:18:30 +00:00
parent 31144f9e4f
commit cbe885c7b9
3 changed files with 25 additions and 10 deletions

View File

@@ -1,3 +1,8 @@
1.35 - the here-doc identifier in saved configs will now created
in a way which avoids the existence of this identifier
inside the here-doc, which if it happens results in
weird behavior in the resulting config.
1.34 - Danial Pearce <danial@infoxchange.net.au> reported a bug
in _store(), which caused the module to create scalar
entries even if the entry contained newlines. While

View File

@@ -1,12 +1,11 @@
#
# Config::General.pm - Generic Config Module
#
# Purpose: Provide a convenient way
# for loading config values from a
# given file and return it as hash
# structure
# Purpose: Provide a convenient way for loading
# config values from a given file and
# return it as hash structure
#
# Copyright (c) 2000-2001 Thomas Linden <tom@daemon.de>.
# Copyright (c) 2000-2002 Thomas Linden <tom@daemon.de>.
# All Rights Reserved. Std. disclaimer applies.
# Artificial License, same as perl itself. Have fun.
#
@@ -18,7 +17,7 @@ use strict;
use Carp;
use Exporter;
$Config::General::VERSION = "1.33";
$Config::General::VERSION = "1.35";
use vars qw(@ISA @EXPORT);
@ISA = qw(Exporter);
@@ -616,12 +615,23 @@ sub _write_scalar {
if ($line =~ /\n/) {
# it is a here doc
my $delimiter;
my $tmplimiter = "EOF";
while (!$delimiter) {
# create a unique here-doc identifier
if ($line =~ /$tmplimiter/s) {
$tmplimiter .= "%";
}
else {
$delimiter = $tmplimiter;
}
}
my @lines = split /\n/, $line;
$config_string .= $indent . $entry . " <<EOF\n";
$config_string .= $indent . $entry . " <<$delimiter\n";
foreach (@lines) {
$config_string .= $indent . $_ . "\n";
}
$config_string .= $indent . "EOF\n";
$config_string .= $indent . "$delimiter\n";
}
else {
# a simple stupid scalar entry
@@ -1467,7 +1477,7 @@ Thomas Linden <tom@daemon.de>
=head1 VERSION
1.34
1.35
=cut

2
README
View File

@@ -65,4 +65,4 @@ AUTHOR
VERSION
1.34
1.35