Andrew Shitov > Config-INI-Access-0.9999 > Config::INI::Access

Download:
Config-INI-Access-0.9999.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.9999   Source  

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. Right now hash syntax may be used to learn out if the element does not exist:

    $unknown = config->non_existing if config->{'non_existing'};
    $unknown = config->section->non_existing if config->section->{'non_existing'};

AUTHOR ^

Andrew Shitov, <andy@shitov.ru>

THANKS

Thanks to Ivan Serezhkin for helping with arrows, asterisks and packages--all the dark sides of Perl.

COPYRIGHT AND LICENSE ^

Config::INI::Access module is a free software. You may redistribute and (or) modify it under the same terms as Perl.

syntax highlighting: