Crane::Config - Configuration manager
use Crane::Config; my $filename = config->{'log'}->{'filename'};
Configuration manager which operates with YAML configurations. Settings are available as a hash reference returned by "config" function.
You can specify default configuration and filename by passing it to "config" function when first call (see description below).
If option is available will use as path to configuration file.
Returns link to current configuration.
When first call you can specify default configuration $config and/or list of config file names @filenames.
Merge two configs ($config to $original).
Reads confugration from file named $filename.
Saves configuration $config to file named $filename.
Load configurations from files named @filenames and merges them to configuration $config and default configuration.
Where %s is file name and %s is error message.
Invalid YAML configuration file.
Fires when unable to open configuration for read.
Fires when unable to open configuration for write.
Fires when function required hash reference as a configuration.
Fires when function required name of file but it is undefined.
Configuration file
domain: "production" log: level: 0 filename: "/var/log/example/messages.log" error_filename: "/var/log/example/errors.log" servers: - "127.0.0.1:3001" - "127.0.0.1:3002"
Which results to hash reference:
{ 'domain' => 'production', 'log' => { 'level' => '0', 'filename' => '/var/log/example/messages.log', 'error_filename' => '/var/log/example/errors.log', }, 'servers' => [ '127.0.0.1:3001', '127.0.0.1:3002', ], }
See Crane::Base.
Default configuration file.
Please report any bugs or feature requests to https://github.com/temoon/crane/issues. I will be notified, and then you'll automatically be notified of progress on your bug as I make changes.
Tema Novikov, <novikov.tema@gmail.com>
Copyright (C) 2013-2014 Tema Novikov.
This library is free software; you can redistribute it and/or modify it under the terms of the Artistic License 2.0. For details, see the full text of the license in the file LICENSE.
Github
https://github.com/temoon/crane
To install Crane, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Crane
CPAN shell
perl -MCPAN -e shell install Crane
For more information on module installation, please visit the detailed CPAN module installation guide.