-
-
04 Mar 2014 12:28:26 UTC
- Distribution: Crane
- Source (raw)
- Browse (raw)
- Changes
- How to Contribute
- Issues (2)
- Testers (136 / 0 / 22)
- Kwalitee
Bus factor: 0- License: artistic_2
- Perl: v5.14.2
- Activity
24 month- Tools
- Download (15.98KB)
- MetaCPAN Explorer
- Permissions
- Subscribe to distribution
- Permalinks
- This version
- Latest version
- Dependencies
- Carp
- Data::Dumper
- English
- Fcntl
- File::Basename
- File::Find
- File::Spec::Functions
- Getopt::Long
- IO::Handle
- POSIX
- Readonly
- Try::Tiny
- YAML
- YAML::Dumper
- and possibly others
- Reverse dependencies
- CPAN Testers List
- Dependency graph
- NAME
- SYNOPSIS
- DESCRIPTION
- EXPORTED FUNCTIONS
- FUNCTIONS
- ERRORS
- EXAMPLES
- ENVIRONMENT
- FILES
- BUGS
- AUTHOR
- COPYRIGHT AND LICENSE
- SEE ALSO
NAME
Crane::Config - Configuration manager
SYNOPSIS
use Crane::Config; my $filename = config->{'log'}->{'filename'};
DESCRIPTION
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).
EXPORTED FUNCTIONS
- config ($config, @filenames)
-
Returns link to current configuration.
At first call you can specify default configuration $config and/or list of config file names @filenames.
FUNCTIONS
- merge_config ($original, $config)
-
Merge two configs ($config to $original).
- read_config ($filename)
-
Reads confugration from file named $filename.
- write_config ($config, $filename)
-
Saves configuration $config to file named $filename.
- load_config ($config, @filenames)
-
Load configurations from files named @filenames and merges them to configuration $config and default configuration.
ERRORS
- Incorrect syntax in '%s': %s
-
Where %s is file name and %s is error message.
Invalid YAML configuration file.
- Unable to read config '%s': %s
-
Where %s is file name and %s is error message.
Fires when unable to open configuration for read.
- Unable to write config '%s': %s
-
Where %s is file name and %s is error message.
Fires when unable to open configuration for write.
- YAML error while writing '%s': %s
-
Where %s is file name and %s is error message.
- Configuration should be a hash reference
-
Fires when function required hash reference as a configuration.
- No filename given
-
Fires when function required name of file but it is undefined.
EXAMPLES
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', ], }
ENVIRONMENT
See Crane::Base.
FILES
BUGS
Please report any bugs or feature requests to https://rt.cpan.org/Public/Bug/Report.html?Queue=Crane or to https://github.com/temoon/crane/issues.
AUTHOR
Tema Novikov, <novikov.tema@gmail.com>
COPYRIGHT AND LICENSE
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.
SEE ALSO
RT Cpan
Github
1 POD Error
The following errors were encountered while parsing the POD:
- Around line 210:
You forgot a '=back' before '=head1'
Module Install Instructions
To install Crane, copy and paste the appropriate command in to your terminal.
cpanm Crane
perl -MCPAN -e shell install Crane
For more information on module installation, please visit the detailed CPAN module installation guide.