NAME
Config::INI::Access - Syntactic sugar for accessing data from .ini-files
SYNOPSIS
use Config::INI::Access;
config->load('config.ini');
print config->section->key;
ABSTRACT
Config::INI::Access allows to access configuration data stored in Windows-formatted .ini-files with arrows rather than hash braces.
DESCRIPTION
Module exports the only user subroutine config
. You should first load the .ini-file calling load()
method, and then receive access to the structure of configuration via Perl's pointer ->
.
INI structure is in fact a hash, but rather than typing extra sigil and braces for accessing hash and subhash elements you simply use an arrow:
print config->section_name->key_name;
Note that no $
sigil comes before config
.
Global keys are available directly:
print config->global_key_name;
At any time configuration may be redefined by calling load()
once more:
config->load('config1.ini');
print config->section->key;
config->load('config2.ini');
print config->section->key;
Keys and values defined in both files are redefined so that keys from a second one replace previously defined. Values that were not redefined remain with their initial values.
TODO
This module should return undef
for attempts of reading the key that does not exists.
AUTHOR
Andrew Shitov, <andy@shitov.ru>
COPYRIGHT AND LICENSE
Config::INI::Access module is a free software. You may redistribute and (or) modify it under the same terms as Perl.