Skip Menu |
 

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

Report information
The Basics
Id: 84142
Status: resolved
Priority: 0/
Queue: Config-Any-Merge

People
Owner: MDOM [...] cpan.org
Requestors: wanradt [...] gmail.com
Cc:
AdminCc:

Bug Information
Severity: Normal
Broken in: (no value)
Fixed in: 0.07



Subject: nothing to merge when flatten_to_hash => 1
Download (untitled) / with headers
text/plain 366b
I was surprised when used Config::Any::Merge and got multiple branched hash with files as keys. So i discovered from source, that Config::Any::Merge enables flatten_to_hash. As far as i understand, when doing that there is nothing to merge, because every file has unique name (with path) and this will used as a unique parent key. The whole idea of merging got lost.
Subject: Re: [rt.cpan.org #84142] nothing to merge when flatten_to_hash => 1
Date: Sun, 16 Jun 2013 12:44:43 +0200
To: "https://launchpad.net/~wanradt via RT" <bug-Config-Any-Merge [...] rt.cpan.org>
From: Mario Domgoergen <mario [...] domgoergen.com>
Download (untitled) / with headers
text/plain 603b
Show quoted text
> I was surprised when used Config::Any::Merge and got multiple > branched hash with files as keys. So i discovered from source, that > Config::Any::Merge enables flatten_to_hash. As far as i understand, > when doing that there is nothing to merge, because every file has unique > name (with path) and this will used as a unique parent key. The whole > idea of merging got lost.
Can you maybe send me an example where Config::Any::Merge returns a hash keyed on filenames? As you noticed i use flatten_to_hash, but a few lines after that i merge the branched hash via Hash::Merge::merge. Cheers, Mario
Download signature.asc
application/pgp-signature 490b

Message body not shown because it is not plain text.

Subject: Re: [rt.cpan.org #84142] nothing to merge when flatten_to_hash => 1
Date: Wed, 19 Jun 2013 14:15:04 +0300
To: bug-Config-Any-Merge [...] rt.cpan.org
From: WK <wanradt [...] gmail.com>
Download (untitled) / with headers
text/plain 3.9k
Hi! Her is little test script: -- use 5.010; use strict; use Data::Dumper; use Config::Any::Merge; my @filepaths = qw|conf/common.json conf/config.yml|; my $cfg = Config::Any->load_files({ files => \@filepaths }); say Dumper $cfg; -- Outoput for my test case: $VAR1 = [ { 'conf/common.json' => { 'DBI' => [ 'DBI:mysql:database=delcampe:mysql_enable_utf8=1', '***********', '***********', { 'AutoCommit' => '1', 'RaiseError' => '1', 'PrintError' => '1' } ] } }, { 'conf/config.yml' => { 'engines' => { 'template_toolkit' => { 'encoding' => 'utf8' } }, 'plugins' => { 'DBIC' => { 'bookstore' => { 'dsn' => 'dbi:SQLite:dbname=bookstore.db', 'dbi_params' => { 'sqlite_unicode' => 1 } } } }, 'template' => 'template_toolkit', 'charset' => 'UTF-8', 'appname' => 'bookstore', 'layout' => 'main', 'logger' => 'console' } } ]; I expected more like this: $VAR1 = { 'DBI' => [ 'DBI:mysql:database=delcampe:mysql_enable_utf8=1', '***********', '***********', { 'AutoCommit' => '1', 'RaiseError' => '1', 'PrintError' => '1' } ] } 'engines' => { 'template_toolkit' => { 'encoding' => 'utf8' } }, 'plugins' => { 'DBIC' => { 'bookstore' => { 'dsn' => 'dbi:SQLite:dbname=bookstore.db', 'dbi_params' => { 'sqlite_unicode' => 1 } } } }, 'template' => 'template_toolkit', 'charset' => 'UTF-8', 'appname' => 'bookstore', 'layout' => 'main', 'logger' => 'console' } }; -- With best reagrds, Gunnar
Subject: Re: [rt.cpan.org #84142] nothing to merge when flatten_to_hash => 1
Date: Fri, 21 Jun 2013 22:08:10 +0200
To: bug-Config-Any-Merge [...] rt.cpan.org
From: Mario Domgörgen <mario [...] domgoergen.com>
Download (untitled) / with headers
text/plain 463b
Hello Gunnar, Show quoted text
> use Config::Any::Merge; > > my @filepaths = qw|conf/common.json conf/config.yml|; > my $cfg = Config::Any->load_files({ files => \@filepaths });
now i see. I made an glaring error in my documention. You have to actually call my $cfg = Config::Any::Merge->load_files({ files => \@filepaths }); to use the module. Could you please test if this solves your problem? I fix the error in the documentation as soon as possible. Best regards, Mario
Subject: Re: [rt.cpan.org #84142] nothing to merge when flatten_to_hash => 1
Date: Sat, 22 Jun 2013 11:35:54 +0300
To: bug-Config-Any-Merge [...] rt.cpan.org
From: WK <wanradt [...] gmail.com>
Download (untitled) / with headers
text/plain 505b
2013/6/21 Mario Domgoergen via RT <bug-Config-Any-Merge@rt.cpan.org>: Show quoted text
> my $cfg = Config::Any::Merge->load_files({ files => \@filepaths }); > > to use the module. > > Could you please test if this solves your problem? I fix the error in the documentation as soon as possible.
Of course it does, thank you. As you see, i just used example without being careful to read it with precausion. At least no one will fall in the same trap, when you patch the docs. -- With best regards, Kõike hääd, Gunnar
fixed in 0.08, currently pending. Thanks for the report! Best regards, Mario


This service is sponsored and maintained by Best Practical Solutions and runs on Perl.org infrastructure.

Please report any issues with rt.cpan.org to rt-cpan-admin@bestpractical.com.