Skip Menu |

This queue is for tickets about the Config-General CPAN distribution.

Report information
The Basics
Id: 35122
Status: resolved
Worked: 8 hours (480 min)
Priority: 0/
Queue: Config-General

People
Owner: tlinden [...] cpan.org
Requestors: muskie73 [...] comcast.net
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in:
  • 2.37
  • 2.38
Fixed in: (no value)



Subject: interpolation issues with blocks
Using the following config file: param1 = This is parameter 1 foo = bar <block1> foo = bored param1 = Something different bar = baz </block1> <block2> thisfoo = $foo param2 = $param1 </block2> with these Config::General options: Config::General->new(-ConfigFile => $config_file, -IncludeRelative => 1, -AutoTrue => 1, -LowerCaseNames => 1, -InterPolateEnv => 1, -InterPolateVars => 1, -MergeDuplicateBlocks => 1, -MergeDuplicateOptions => 1, -UseApacheInclude => 1, ); In Config::General versions prior to 2.37, I get this: $VAR1 = { 'block1' => { 'bar' => 'baz', 'foo' => 'bored', 'param1' => 'Something different' }, 'block2' => { 'thisfoo' => 'bar', 'param2' => 'This is parameter 1' }, 'foo' => 'bar', 'param1' => 'This is parameter 1' }; However with Config::General 2.37 and 2.38, I now get this: $VAR1 = { 'block1' => { 'bar' => 'baz', 'foo' => 'bored', 'param1' => 'Something different' }, 'block2' => { 'thisfoo' => 'bored', 'param2' => 'Something different' }, 'foo' => 'bar', 'param1' => 'This is parameter 1' }; The value of "thisfoo" inside block2 has now taken the value of "foo" that was defined in block1. If I understand the docs correctly, shouldn't the redefined value for "foo" remain local to block1 only so that block2 takes the top-level value of "foo"? Maybe this is related to the changes for bug 30063? Let me know if you need more info. Thanks!
Well, this seems to be a very scary problem. The second named block doesnt inherit the varstack of the underlying block but the one of the first named block instead. For whatever reason. Looks like kindof circular references and I'm not really sure if I understand what happens. I need more beer.
Fixed in 2.39. This was a really weird bug. The contents of the internal variable stack were copied by reference not by value. I added a simple function which copies just the values for later inheritance - which solved the problem. Eight hours work for such a damn crab (which I wrote myself, err). regards, Tom