Hi,
sorry for the late reply.
I'm not going to change this anytime soon, if ever. Quote parsing for values is already a messy business, doing the same for keys would just double the mess. If quoted keys would be supported than I would need to add different behavior for single and double quotes and stuff like that. Eg:
"some key" one = 123
what would be the key? Should this be an error?
or:
'my = var' = 89
where to split here? Intuitively I'd say, the key should be "my = var" because there are single quotes which people consider that it marks the stuff in between to be kept "as is".
So I could not just apply the Split Policy, split keys and values and then removing eventually existing quotes on keys. IF there were quote support for keys, it should work like quotes usually tend to work. That means, I had to parse for quoted keys first and then applying the Split Policy, which makes things complicated internally.
So, I'm not going to implement this anytime soon, sorry.
However, you could achieve something like this using a plugin:
my $conf = Config::General->new(
-ConfigFile => shift(),
-SplitPolicy => 'equalsign',
-Plug => {
'post_read' => sub {
my $lines = shift;
my @new;
foreach my $line (@{$lines}) {
$line =~ s/^\"([^\"]*)\"/$1/; # remove quotes around keys, if any
push @new, $line
}
return (1, \@new);
}
}
);
config:
use = blah
"ano ther" = foo
output:
$VAR1 = {
'use' => 'blah',
'ano ther' => 'foo'
};
best regards,
Tom