Tie::ConfigFile - Tie configuration file to a hash
use Tie::ConfigFile; my %hash; tie %hash, 'Tie::ConfigFile', filename => 'foobar.conf', readonly => 0; $hash{foo} = 'bar'; # will be written to foobar.conf untie %hash;
This module allows you to tie configuration file to a hash. To understand what "tie" means in this context, read perltie. Comments, empty lines and order in configuration file are always preserved. Formatting of a line is preserved unless you modify its value.
key=value ;comment another_key = value key with spaces=value with spaces key after break=1
filename (string, mandatory) - Path to a configuration file.
filename
create_file (boolean, default: 0) - Try to create configuration file if it doesn't exist.
create_file
0
readonly (boolean, default: 1) - Disallow writing to the config file.
readonly
1
Nothing is exported.
When more than one process uses configuration file in non-readonly mode, data loss may happen.
Multidimensional hashes are not supported.
Tie::Cfg
Tie::Config
Tie::ConfigFile Fossil repository is hosted at my own server:
http://code.xenu.pl/repos.cgi/tie-configfile
Tomasz Konojacki <me@xenu.pl>
Copyright (C) 2014-2016 by Tomasz Konojacki
This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself, either Perl version 5.18.2 or, at your option, any later version of Perl 5 you may have available.
To install Tie::ConfigFile, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Tie::ConfigFile
CPAN shell
perl -MCPAN -e shell install Tie::ConfigFile
For more information on module installation, please visit the detailed CPAN module installation guide.