Config-Onion

 view release on metacpan or  search on metacpan

README.mkdn  view on Meta::CPAN


# PROPERTIES

## cfg

## get

Returns the complete configuration as a hash reference.

## default

## main

## local

## override

These properties each return a single layer of the configuration.  This is
not likely to be useful other than for debugging.  For most other purposes,
you probably want to use `get` instead.

## prefix\_key

If set, enables the Prefix Structures functionality described below when using
the `load` or `load_glob` methods.  The value of `prefix_key` specifies the
name of the key under which the  prefix structure may be found.

Default value is `undef`.

# Prefix Structures

If you find that your configuration structure is becoming unwieldy due to
deeply-nested structures, you can define a file-specific "prefix structure"
and all other settings within that file will be loaded as children of the
prefix structure.  For example, if your main program uses

    $cfg = Config::Onion->new(prefix_key => '_prefix');
    $cfg->load("myapp/config");

and `myapp/config.yml` contains

    _prefix:
      foo:
        bar:

    baz: 1

then `$cfg` will contain the configuration

    foo:
      bar:
        baz: 1

Note that the top-level `prefix_key` is removed.

There are some limitations on the prefix structure, in order to keep it sane
and deterministic.  First, the prefix structure may only contain hashes.
Second, each hash must contain exactly one key.  Finally, the value associated
with the final key must be left undefined.

# BUGS AND LIMITATIONS

No bugs have been reported.

Please report any bugs or feature requests at
[https://github.com/dsheroh/Config-Onion/issues](https://github.com/dsheroh/Config-Onion/issues)

# AUTHOR

Dave Sherohman <dsheroh@cpan.org>

# COPYRIGHT AND LICENSE

This software is copyright (c) 2012 by Lund University Library.

This is free software; you can redistribute it and/or modify it under
the same terms as the Perl 5 programming language system itself.



( run in 2.309 seconds using v1.01-cache-2.11-cpan-75ffa21a3d4 )