mirror of
https://codeberg.org/scip/Config-General.git
synced 2025-12-16 20:21:01 +01:00
2.39
- fixed rt.cpan.org#35122. This one was one of the most intriguing bugs I've ever observed in my own code. The internal temporary __stack hashref were copied from one subhash to another to enable inheritance of variables. However, the hashes were copied by reference, so once a value changed later, that value were overwritten because the __stack in question were just a reference. I introduced a simple function _copy() which copies the contents of the __stack by value, which solved the bug. Conclusion: beware of perl hash refs! - fixed rt.cpan.org#36607, accept whitespaces in heredoc names if split delimiter is gues (equalsign or whitespace) - fixed rt.cpan.org#34080 (typo) - fixed rt.cpan.org#35766. Variables inside single quoted strings will no more interpolated (as the docu states). Also added test case for this. - fixed bug rt.cpan.org#33766. Checking for defined not true in ::Extended::AUTOLOAD(). - added -UTF8 flag, which opens files in utf8 mode (suggested by KAORU, rt.cpan.org#35583) I decided not to add a test case for this, since perls utf8 support is not stable with all versions. git-svn-id: http://dev.catalyst.perl.org/repos/Config-General/trunk@65 be1acefe-a474-0410-9a34-9b3221f2030f
This commit is contained in:
14
t/cfg.45
Normal file
14
t/cfg.45
Normal file
@@ -0,0 +1,14 @@
|
||||
param1 = value1
|
||||
param2 = value2
|
||||
|
||||
<block1>
|
||||
param2 = value3
|
||||
param4 = $param1 # expect: "value1"
|
||||
param5 = $param2 # expect: "value3"
|
||||
</block1>
|
||||
|
||||
<block2>
|
||||
param6 = $param1 # expect: "value1"
|
||||
param7 = $param2 # expect: "value2"
|
||||
</block2>
|
||||
|
||||
3
t/cfg.46
Normal file
3
t/cfg.46
Normal file
@@ -0,0 +1,3 @@
|
||||
foo = bar
|
||||
blah = blubber
|
||||
test = $foo 'variable $blah should be kept' and '$foo too'
|
||||
32
t/run.t
32
t/run.t
@@ -8,7 +8,7 @@
|
||||
|
||||
|
||||
use Data::Dumper;
|
||||
use Test::More tests => 45;
|
||||
use Test::More tests => 47;
|
||||
#use Test::More qw(no_plan);
|
||||
|
||||
### 1
|
||||
@@ -457,3 +457,33 @@ eval {
|
||||
};
|
||||
ok(! $@, "-String arrayref");
|
||||
is_deeply({ $conf44->getall }, { foo => 'bar' }, "-String arrayref contents");
|
||||
|
||||
|
||||
|
||||
# verifies bug rt#35122
|
||||
my $conf45 = new Config::General(-ConfigFile => "t/cfg.45", -InterPolateVars => 1, -StrictVars => 0);
|
||||
my %conf45 = $conf45->getall();
|
||||
my $expect45 = {
|
||||
'block1' => {
|
||||
'param5' => 'value3',
|
||||
'param4' => 'value1',
|
||||
'param2' => 'value3'
|
||||
},
|
||||
'block2' => {
|
||||
'param7' => 'value2',
|
||||
'param6' => 'value1'
|
||||
},
|
||||
'param2' => 'value2',
|
||||
'param1' => 'value1'
|
||||
};
|
||||
is_deeply($expect45, \%conf45, "Variable precedence");
|
||||
|
||||
# verifies bug rt#35766
|
||||
my $conf46 = new Config::General(-ConfigFile => "t/cfg.46", -InterPolateVars => 1, -StrictVars => 0);
|
||||
my %conf46 = $conf46->getall();
|
||||
my $expect46 = {
|
||||
'blah' => 'blubber',
|
||||
'test' => 'bar \'variable $blah should be kept\' and \'$foo too\'',
|
||||
'foo' => 'bar'
|
||||
};
|
||||
is_deeply($expect46, \%conf46, "Variables inside single quotes");
|
||||
|
||||
Reference in New Issue
Block a user