Configuration Refinements
Branch: master
Clone or download
Latest commit 2c2d9f0 Jun 2, 2018
Type Name Latest commit message Commit time
Failed to load latest commit information.
doc version and comments Jun 2, 2018
label license label on top of readme Oct 19, 2016
xt Avoid use of removed method Apr 11, 2017
.gitignore documentation Jun 3, 2016
.travis.yml dropped cache Apr 19, 2017
LICENSE start of project Jun 1, 2016
META6.json version and comments Jun 2, 2018 pod doc and readme Dec 27, 2016
appveyor.yml modified to use zef instead of panda Apr 19, 2017

Configuration refinements

Build Status AppVeyor Build Status License


The following piece of code

use Config::DataLang::Refine;

my Config::DataLang::Refine $c .= new(:config-name<myConfig.toml>);

my Hash $hp1 = $c.refine(<options plugin1 test>);
my Hash $hp2 = $c.refine(<options plugin2 deploy>);

With the following config file in myConfig.toml

  key1 = 'val1'

  key2 = 'val2'

  key1 = false
  key2 = 'val3'

  key3 = 'val3'

Will get you the following as if $hp* is set like

$hp1 = { key2 => 'val3'};
$hp2 = { key1 => 'val1', key3 => 'val3'};

A better example might be from the MongoDB project to test several server setups, the config again in TOML format;

  journal = false
  fork = true
  smallfiles = true
  oplogSize = 128
  logappend = true

# Configuration for Server 1
  logpath = './Sandbox/Server1/m.log'
  pidfilepath = './Sandbox/Server1/'
  dbpath = './Sandbox/Server1/'
  port = 65010

  replSet = 'first_replicate'

  replSet = 'second_replicate'

  auth = true

Now, to get run options to start server 1 one does the following;

my Config::DataLang::Refine $c .= new(:config-name<mongoservers.toml>);
my Array $opts = $c.refine-str( <mongod s1 replicate1>, :C-UNIX-OPTS-T2);

# Output
# --nojournal, --fork, --smallfiles, --oplogSize=128, --logappend,
# --logpath='./Sandbox/Server1/m.log', --pidfilepath='./Sandbox/Server1/',
# --dbpath='./Sandbox/Server1/', --port=65010, --replSet=first_replicate

Easy to run the server now;

my Proc $proc = shell(('/usr/bin/mongod', |@$opts).join(' '));


The Config::DataLang::Refine class adds facilities to use a configuration file and gather the key value pairs by searching top down a list of keys thereby refining the resulting set of keys. Boolean values are used to add a key without a value when True or to cancel a previously found key out when False.


Look for documentation and other information at