NAME

Tie::ConfigFile - Tie configuration file to a hash

SYNOPSIS

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;

DESCRIPTION

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.

EXAMPLE CONFIG FILE

key=value
;comment
another_key = value
key with spaces=value with spaces

key after break=1

OPTIONS

  • filename (string, mandatory) - Path to a configuration file.

  • create_file (boolean, default: 0) - Try to create configuration file if it doesn't exist.

  • readonly (boolean, default: 1) - Disallow writing to the config file.

EXPORT

Nothing is exported.

CAVEATS

  • When more than one process uses configuration file in non-readonly mode, data loss may happen.

  • Multidimensional hashes are not supported.

SEE ALSO

FOSSIL REPOSITORY

DBD::IngresII Fossil repository is hosted at xenu.tk:

http://code.xenu.tk/repos.cgi/tie-configfile

AUTHOR

Tomasz Konojacki <me@xenu.tk>

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 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.

1 POD Error

The following errors were encountered while parsing the POD:

Around line 312:

You forgot a '=back' before '=head1'