The London Perl and Raku Workshop takes place on 26th Oct 2024. If your company depends on Perl, please consider sponsoring and/or attending.

NAME

Config::Simple::Conf - an extremely fast, light weight configuration file parser with caching

SYNOPSIS

use Config::Simple::Conf;

my $conf = Config::Simple::Conf->new('/etc/Something/Example.conf');

print $conf->value('global', 'example_key');

CONFIGURATION FILE FORMAT

See examples/ directory for various configuration file examples

METHODS

new()

Config::Simple::Conf->new(FILE, CFHASH)

Generate / Regenerate the configuration hash reference based on on standard Ruckus configuration files and options.

 FILE         -  The configuratino file to process, if
                 undefined @ARGV will be processed for
                 arguments.

 CFHASH       -  An existing configuraiton hash generated
                 by Config::Simple::Conf  in which data should be appended
                 to.

Returns a hash reference with two types of values:

A standard string "abc", and array reference ["a","b","c"]. In cases of unique keys data is stored as a string. In cases were there are multiple duplicate keys data is stored in an array reference.

Keys may make use of other keys values with in the key value.

 Example:
   [example]
   # sets [example:abc] to '123'
   abc = 123

   # sets [efg] to '123'
   efg = [example:abc]

   # sets [example:list] to [1, 2, 3]
   list = 1
   list = 2
   list = 3

When making use of other key's values (as explainded in the example above) the embedded key '[abc]' MUST be unique. Using embedded keys in a listing context is not allowed and will result in an fatal error.

In some cases configuration files may need to include other configuration files. The way this is done is via a speical key called 'include'. The same file will be automatically execluded if it's detected multiple times.

value(SECTION, KEY)

Retrieve a configuration value or list from SECTION for KEY keyname.

By rule, entries outside of a section are 'global', entries within the CLI arguments list are in section 'argv'

islist(SECTION, KEY)

Return true if the SECTION's KEY is a list of entries

sections()

Return a list of available sections

keys(SECTION)

Return the keys for a given section

AUTHOR

Colin Faber <cfaber@fpsn.net>

LICENSE AND COPYTIGHT

Copyright 2016 (C) Colin Faber

This library is licensed under the Perl Artistic license and may be freely used and distributed under the terms of Perl itself.