Show quoted text> If I wanted to "dogge" the issue, I had not responded to it in the first place.
I just consider any possible case, doesn't mean to offend you in any way, sorry.
Show quoted text> if you want me to fix the bug (if there is one), then you have to provide a reproducible test case.
I did. Unfortunately, the issue I got looks like to be caused by something I don't know which is not equal on our respective setups. Perl offer a way to choose hash function at build time (
http://onionstand.blogspot.fr/2012/12/are-you-relying-on-hash-keys-being.html) and probably the version we use were not built using the same config, I don't know. The fact that the exact same code behave in two different ways on two different setups just confuses me.
Show quoted text> Also, you did not respond to the rest of my last comment: did you test it with -Tie and what was the result?
I took time to work on this and I get this (change in bold lead to 1000 ok/0 ko consistently):
use strict;
use Config::General;
use Data::Dumper;
use Tie::IxHash;
my $config =
{
...
};
tie %$config, "Tie::IxHash";
my ($oks, $errors) = (0, 0);
for (my $count = 0; $count < 1000; $count++)
{
eval
{
my $cgobject = Config::General->new
(
-ConfigFile => '.configgen-issue.cfg',
...
-UTF8 => 1,
-Tie => 'Tie::IxHash',
);
my %finalconfig = $cgobject->getall ();
... (everything else is identical)
So, using Tie::IxHash fix the issue.
Thanks for your help on this.
Regards.
Show quoted text________________________________
From: T. Linden via RT <bug-Config-General@rt.cpan.org>
Sent: Tuesday, October 18, 2016 4:32 PM
To: justice__8@hotmail.com
Subject: [rt.cpan.org #118383] Variables interpolation sometimes doesn't work
<URL:
https://rt.cpan.org/Ticket/Display.html?id=118383 >
On Tue Oct 18 09:41:54 2016, justice__8@hotmail.com wrote:
> All of this is nice but a bit irrelevant as the issue occurred when I
> use variables AND default config as the first samples given in this
> issue report.
Great, so I don't need to explain anything anymore.
> The DefaultConfig description is:
>
> > This can be a hash reference or a simple scalar (string) of a config.
> > This causes the module to preset the resulting config hash with the
> > given values, which allows you to set default values for particular
> > config options directly.
>
> Which doesn't tell me not to do so.
Which is not what I said.
> So, IMHO, you could either choose to dodge the issue[..]
If I wanted to "dogge" the issue, I had not responded to it in the first place.
> It's is a bit strange you cannot get the issue
No, it behaves as I expect it to behave.
> If you haven't done it yet, could you try with the file content above
> please ?
I already did that, but I did it again:
ok=1000 ko=0
It didn't fail, as there's nothing to interpolate in the first place. Just to recount, this is the default config I used (according to your posts):
my $config =
{
item => 1,
blockone =>
{
var => 'something',
foo => 'bar',
},
};
And this is the config with comments removed:
myvar = something
<blockone>
foo = notbar
var = $myvar
another = novar
</blockone>
From this, Config:General came up with this:
{
'item' => 1,
'myvar' => 'something',
'blockone' => {
'another' => 'novar',
'var' => 'something',
'foo' => 'notbar'
}
};
Looks legit.
If you want me to fix the bug (if there is one), then you have to provide a reproducible test case.
Also, you did not respond to the rest of my last comment: did you test it with -Tie and what was the result?
- Tom