NAME

Nile::Config - Configuration file manager.

SYNOPSIS

    # get the app config object
    $config = $self->app->config;
    
    # get a new config object
    $config = $self->app->config->new;
    
    # keep sort order when reading and writing the xml file data. default is off.
    #$config->keep_order(1);

    # load config file from the configuration folder, file extension is xml.
    $config->load("config");

    # load and append another configuration file
    $config->add_file("admins");
    
    # get config variables
    say $config->get("admin/user");
    say $config->get("admin/password");
        
    # get config variable, if not found return the optional provided default value.
    $var = $config->get($name, $default);

    # automatic getter support
    say $config->email; # same as $config->get('email');

    # get a group of config variables.
    @list = $config->list(@names);

    # delete config variables from memory, changes will apply when saving file.
    $config->delete(@names);

    # set config variables.
    $config->set("admin", 'username');
    $config->set(%vars);

    # automatic setter support
    $config->email('ahmed@mewsoft.com'); # same as $config->set('email', 'ahmed@mewsoft.com');
    
    # save changes to file.
    $config->save();

    # write to another output file.
    $config->save($file);

DESCRIPTION

Nile::Config - Configuration file manager.

Configuration files are xml files stored in the application config folder. You can load and manage any number of configuration files.

This class extends Nile::XML class, therefore all methods from Nile::XML is accessable to this object.

Bugs

This project is available on github at https://github.com/mewsoft/Nile.

HOMEPAGE

Please visit the project's homepage at https://metacpan.org/release/Nile.

SOURCE

Source repository is at https://github.com/mewsoft/Nile.

SEE ALSO

See Nile for details about the complete framework.

AUTHOR

Ahmed Amin Elsheshtawy, احمد امين الششتاوى <mewsoft@cpan.org> Website: http://www.mewsoft.com

COPYRIGHT AND LICENSE

Copyright (C) 2014-2015 by Dr. Ahmed Amin Elsheshtawy احمد امين الششتاوى mewsoft@cpan.org, support@mewsoft.com, https://github.com/mewsoft/Nile, http://www.mewsoft.com

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