fixed rt.cpan.org#39814.

git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@99 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
Thomas von Dein
2014-05-01 11:19:25 +00:00
parent 010403fd8a
commit 480548e19d
5 changed files with 25 additions and 8 deletions

View File

@@ -1,3 +1,7 @@
2.54 - fixed rt.cpan.org#39814. changed the order of pre-processing
in _read(): 1) remove comments, 2) check for continuation,
3) remove empty lines.
2.53 - applied patch rt.cpan.org#68153, which adds a find() method to 2.53 - applied patch rt.cpan.org#68153, which adds a find() method to
Config::General::Extended. Config::General::Extended.

View File

@@ -32,7 +32,7 @@ use Carp::Heavy;
use Carp; use Carp;
use Exporter; use Exporter;
$Config::General::VERSION = "2.53"; $Config::General::VERSION = "2.54";
use vars qw(@ISA @EXPORT_OK); use vars qw(@ISA @EXPORT_OK);
use base qw(Exporter); use base qw(Exporter);
@@ -632,12 +632,12 @@ sub _read {
# Remove comments and empty lines # Remove comments and empty lines
s/(?<!\\)#.*$//; # .+ => .* bugfix rt.cpan.org#44600 s/(?<!\\)#.*$//; # .+ => .* bugfix rt.cpan.org#44600
next if /^\s*#/; next if /^\s*#/;
next if /^\s*$/; #next if /^\s*$/;
# look for multiline option, indicated by a trailing backslash # look for multiline option, indicated by a trailing backslash
if (/(?<!\\)\\$/) { if (/(?<!\\)\\$/) {
chop; chop; # remove trailing backslash
s/^\s*//; s/^\s*//;
$longline .= $_; $longline .= $_;
next; next;
@@ -706,6 +706,9 @@ sub _read {
next; next;
} }
else { else {
# ignore empty lines
next if /^\s*$/;
# look for include statement(s) # look for include statement(s)
my $incl_file; my $incl_file;
my $path = ''; my $path = '';
@@ -2745,7 +2748,7 @@ Thomas Linden <tlinden |AT| cpan.org>
=head1 VERSION =head1 VERSION
2.53 2.54
=cut =cut

6
README
View File

@@ -80,11 +80,11 @@ UPDATE
COPYRIGHT COPYRIGHT
Config::General Config::General
Config::General::Extended Config::General::Extended
Copyright (c) 2000-2007 by Thomas Linden <tom@daemon.de> Copyright (c) 2000-2014 by Thomas Linden <tom@daemon.de>
Config::General::Interpolated Config::General::Interpolated
Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw> Copyright (c) 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>
Copyright (c) 2002-2007 by Thomas Linden <tom@daemon.de>. Copyright (c) 2002-2014 by Thomas Linden <tom@daemon.de>.
This library is free software; you can redistribute it This library is free software; you can redistribute it
and/or modify it under the same terms as Perl itself. and/or modify it under the same terms as Perl itself.
@@ -104,4 +104,4 @@ AUTHOR
VERSION VERSION
2.50 2.54

5
t/cfg.55 Normal file
View File

@@ -0,0 +1,5 @@
a = 1
b = nochop\
c = should stay alone

View File

@@ -8,7 +8,7 @@
use Data::Dumper; use Data::Dumper;
use Test::More tests => 70; use Test::More tests => 71;
#use Test::More qw(no_plan); #use Test::More qw(no_plan);
# ahem, we deliver the test code with a local copy of # ahem, we deliver the test code with a local copy of
@@ -737,3 +737,8 @@ ok( !@WARNINGS_FOUND, "No unexpected warnings seen" );
my $cfg54 = new Config::General(-NoEscape => 1, -String => qq(val = \\\$notavar:\\blah\n)); my $cfg54 = new Config::General(-NoEscape => 1, -String => qq(val = \\\$notavar:\\blah\n));
my %hash54 = $cfg54->getall(); my %hash54 = $cfg54->getall();
is($hash54{val}, qq(\\\$notavar:\\blah), "check -NoEscape"); is($hash54{val}, qq(\\\$notavar:\\blah), "check -NoEscape");
# check for line continuation followed by empty line (rt.cpan.org#39814)
my $cfg55 = new Config::General( -ConfigFile => "t/cfg.55" );
my %hash55 = $cfg55->getall();
is($hash55{b}, "nochop", "check continuation followed by empty line");