The Perl Toolchain Summit needs more sponsors. If your company depends on Perl, please support this very important event.

NAME

CTK::Configuration - Configuration of CTK

VERSION

Version 1.00

SYNOPSIS

    use CTK::Configuration;

    my $config = new CTK::Configuration(
            config  => "foo.conf",
            confdir => "conf",
            options => {... Config::General options ...},
        );

DESCRIPTION

The module works with the configuration

new

    my $config = new CTK::Configuration(
            config  => "/path/to/config/file.conf",
            confdir => "/path/to/config/directory",
            options => {... Config::General options ...},
        );

Example foo.conf file:

    Foo     1
    Bar     test
    Flag    true

Example of the "conf" structure of $config object:

    print Dumper($config->{conf});
    $VAR1 = {
        'foo' => 1
        'bar' => 'test',
        'flag' => 1,
    }
config

Specifies absolute or relative path to config-file.

confdir, dir

Specifies absolute or relative path to config-dir.

options

Options of Config::General

METHODS

error
    my $error = $config->error;

Returns error string if occurred any errors while creating the object or reading the configuration file

conf
    my $value = $config->conf( 'key' );

Gets value from config structure by key

    my $config_hash = $config->conf;

Returns config hash structure

get
    my $value = $config->get( 'key' );

Gets value from config structure by key

getall
    my $config_hash = $config->getall;

Returns config hash structure

set
    $config->set( 'key', 'value' );

Sets value to config structure by key. Returns setted value

status
    print $config->error unless $config->status;

Returns boolean status of loading config file

HISTORY

1.00 Mon Apr 29 10:36:06 MSK 2019

Init version

See Changes file

DEPENDENCIES

Config::General, Try::Tiny

TO DO

See TODO file

BUGS

* none noted

SEE ALSO

Config::General

AUTHOR

Serż Minus (Sergey Lepenkov) http://www.serzik.com <abalama@cpan.org>

COPYRIGHT

Copyright (C) 1998-2019 D&D Corporation. All Rights Reserved

LICENSE

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

See LICENSE file and https://dev.perl.org/licenses/