NAME
OTRS::OPM::Analyzer::Utils::Config - class to parse a yaml config
VERSION
version 0.02
SYNOPSIS
use OTRS::OPM::Analyzer::Utils::Config;
my $config = '/path/to/config.yml';
my $obj = OTRS::OPM::Analyzer::Utils::Config->new( $config );
print $obj->get( 'app.path' ); # /opt/otrs/
print $obj->get( 'app' )->{path}; # /opt/otrs/
$obj->set( 'app.version', '3.3.3' );
print $obj->get( 'app.version' ); # 3.3.3
config.yml
---
app:
path: /opt/otrs/
METHODS
new
Creates a new object of the config parser
use OTRS::OPM::Analyzer::Utils::Config;
my $config = '/path/to/config.yml';
my $obj = OTRS::OPM::Analyzer::Utils::Config->new( $config );
load
Loads a new config
my $config = '/path/to/config.yml';
my $obj = OTRS::OPM::Analyzer::Utils::Config->new;
$obj->load( $config );
get
Returns the value of a given config key. Multilevel hashes can be separated with a '.'
print $obj->get( 'app.path' ); # /opt/otrs/
print $obj->get( 'app' )->{path}; # /opt/otrs/
set
Sets a config option
$obj->set( 'app.version', '3.3.3' );
AUTHOR
Renee Baecker <reneeb@cpan.org>
COPYRIGHT AND LICENSE
This software is Copyright (c) 2014 by Renee Baecker.
This is free software, licensed under:
The Artistic License 2.0 (GPL Compatible)