NAME
Config::Tree::CmdLine - Read configuration tree from command line options
SYNOPSIS
# in shell:
% perl script.pl --foo/bar=3
% perl script.pl --foo='{bar: 3}'; # same thing
# in script.pl:
use Config::Tree::CmdLine;
my $conf = Config::Tree::CmdLine->new(
# schema => ...,
# when_invalid => ...,
# include_path_re => qr/.../,
# exclude_path_re => qr/.../,
ro => 0,
);
my $val = $conf->get('/foo/bar'); # 3
$conf->cd('/foo');
$conf->set('bar', 10); # same as set('/foo/bar', 10);
DESCRIPTION
ATTRIBUTES
METHODS
new(%args)
Construct a new Config::Tree::CmdLine object. Arguments.
ro
. Optional, default is 0. Whether we should disallow set() and save().when_invalid
. Optional, default is 'die'. What to do when file content does not validate with supplied schema. Choices: 'die', 'warn', 'quiet'.exclude_path_re
. Optional. When set, config path matching the regex will not be retrieved. See also:include_path_re
.include_path_re
. Optional. When set, only config path matching the regex will be retrieved. Takes precedence overexclude_path_re
.schema
. Optional. When specified, after the tree is retrieved, it will be validated against this schema using Data::Schema.
usage()
Prints usage information. Requires schema be specified.
set($path, $val)
Does nothing.
save()
Does nothing.
SEE ALSO
Data::Schema, Config::Tree::Base
AUTHOR
Steven Haryanto, <stevenharyanto at gmail.com>
COPYRIGHT & LICENSE
Copyright 2009 Steven Haryanto, all rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.