Skip Menu |

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

Report information
The Basics
Id: 83114
Status: rejected
Priority: 0/
Queue: Config-General

People
Owner: Nobody in particular
Requestors: abraxxa [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Critical
Broken in: 2.51
Fixed in: (no value)



Subject: -DefaultConfig hashref is modified
#!/usr/bin/env perl use strict; use warnings; use Config::General; use Data::Dumper::Concise; my %defaults = ( foo => 'bar' ); warn Dumper(\%defaults); my %config = Config::General->new( -ConfigFile => 'foo.conf', -DefaultConfig => \%defaults, )->getall; warn Dumper(\%defaults); The contents of foo.conf: foo bar output: { foo => "bar" } { foo => [ "bar", "bar" ] } As you can see the second dump of %defaults contains the merged config.
Well, that's IMHO the intended behavior. From the modules point of view, it reads a config like this: foo=bar foo=bar What to do with that? There can't be a hash like this: { foo => 'bar', foo => 'bar' } So, either it has to make an array of the two values, which is the default, or it has to overwrite the first with the second. This can be controlled with -MergeDuplicateOptions (default: off). Other than that I don't know how to handle this differently as it is now. best, Tom