in reply to Config::General default config settings
Parse the config file and change the values in the resulting data structure, let's say we want to default the username on the servers:
use strict; use warnings; use Data::Dumper; use Config::General; my $conf = Config::General->new( -ConfigFile => \*DATA ); my %config = $conf->getall; $_->{username} ||= 'Pascal2020' for $config{server1}, $config{server2} +; print Dumper \%config; __DATA__ <server1> host = server1.domain.tld ssl = true port = 443 username = password = qwerty vhost = example </server1> <server2> host = server2.domain.tld ssl = false port = 2080 username = password = qwerty vhost = example </server2>
There are many ways to do this, what did you try?
jeffa
L-LL-L--L-LL-L--L-LL-L-- -R--R-RR-R--R-RR-R--R-RR B--B--B--B--B--B--B--B-- H---H---H---H---H---H--- (the triplet paradiddle with high-hat)
|
|---|