NAME
Test::BDD::Infrastructure::Config - configuration variables support for Test::BDD::Infrastructure
VERSION
version 1.005
Description
The module provides a abstraction to retrieve configuration values from different configuration backends.
Synopsis
Load a configuration in step_files/00use_steps.pl:
use Test::BDD::Infrastructure::Config;
my $c = Test::BDD::Infrastructure::Config->new;
$c->load_config( dirname(__FILE__)."/config.yaml" );
Or register additional configuration backends:
use Test::BDD::Infrastructure::Config::Augeas;
use Test::BDD::Infrastructure::Config::Facter;
$c->register_config(
'a' => Test::BDD::Infrastructure::Config::Facter->new,
);
In config.yaml:
web:
baseurl: http://www.example.tld/
Then retrieve the value with:
$c->get( 'c', 'web/baseurl');
Or to retrieve a value from the Augeas backend:
$c->get( 'a', '/files/etc/resolv.conf/nameserver');
Methods
register_config( $scope, $backend )
Registers a new configuration backend.
unregister_config( $scope )
Unregisters the backend in $scope.
clear_all_configs
Unregisters all configuration backends.
load_config( $file )
This is an alias for loading a YAML file to the scope 'c':
$config->register_config(
'c' => Test::BDD::Infrastructure::Config::YAML->new(
file => $file,
)
);
get_node( $scope, $path )
Retrieve a node within the configuration tree with all its subentries.
get ( $scope, $path )
Retrieve a configuration value.
See also
Test::BDD::Infrastructure::Config::YAML, Test::BDD::Infrastructure::Config::Augeas, Test::BDD::Infrastructure::Config::Facter
AUTHOR
Markus Benning <ich@markusbenning.de>
COPYRIGHT AND LICENSE
This software is copyright (c) 2015 by Markus Benning.
This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.