PERL : Libconf::Glueconf::Networking::Hosts C/PYTHON/RUBY : Networking/Hosts
Libconf::Glueconf::Networking::Hosts is a template to handle /etc/hosts style files.
$hosts = new Libconf::Glueconf::Networking::Hosts({ filename => '/etc/hosts' }); $hosts->{'127.0.0.1'}{aliases} = q(me myself I); $hosts->{'127.0.0.1'}{canonical_hostname} = '10calH0st'; $hosts->write_conf(); $hosts->write_conf('alternate_file);
creates the template
$hosts = new Libconf::Glueconf::Networking::Hosts({ .. arguments .. })
the options are the same as in the Libconf::Templates::Generic::KeyValues manpage, look there to have the details.
See <Libconf::Glueconf> for general methods