Config::Tree::CmdLine - Read configuration tree from command line options


Config-Tree documentation  | view source Contained in the Config-Tree distribution.

Index


NAME

Top

Config::Tree::CmdLine - Read configuration tree from command line options

SYNOPSIS

Top

 # READING CONFIG FROM COMMAND LINE

 # in shell:

 % perl script.pl --foo/bar=3
 % perl script.pl --foo='{bar: 3}'; # same thing
 % perl script.pl '{bar: 3}'; # same thing, since ui.order of foo is 0

 # in script.pl:

 use Config::Tree::CmdLine;

 my $conf = Config::Tree::CmdLine->new(
     schema => [hash=>{keys=>{
         foo=>[hash=>{ keys=>{bar=>"int"}, "ui.order"=>0, "ui.description"=>"Foo is blah" }],
         baz=>[str=>{ "ui.order"=>1, "ui.description"=>"Baz is blah..." }],
     }}],
     # when_invalid => ...,
     # include_path_re => qr/.../,
     # exclude_path_re => qr/.../,
     # must_exist => 0|1,
     # special_options => {...},
     ro    => 0,
 );
 my $val = $conf->get('/foo/bar'); # 3
 $conf->cd('/foo');
 $conf->set('bar', 10); # same as set('/foo/bar', 10);




 # DISPLAYING HELP

 # in shell:
 % perl script.pl --help; # will display help using information from schema

DESCRIPTION

Top

ATTRIBUTES

Top

METHODS

Top

new(%args)

Construct a new Config::Tree::CmdLine object. Arguments.

usage()

Prints usage information. Requires schema be specified.

set($path, $val)

Does nothing.

save()

Does nothing.

SEE ALSO

Top

Data::Schema, Config::Tree::Base

AUTHOR

Top

Steven Haryanto, <stevenharyanto at gmail.com>

COPYRIGHT & LICENSE

Top


Config-Tree documentation  | view source Contained in the Config-Tree distribution.