Config::Layered::Source::Getopt - The Command Line Source
The Getopt source provides access to Getopt::Long and will configure it based on the default data structure.
The configuration of the Getopt::Long options is done in the following way:
If the default value of a key is 0 or 1, it is treated as a boolean, and the key! directive is used. This will enable --no* options to work as expected.
key!
--no*
If the value is a hash reference, the key% directive is used, and options are configured as --key name=value. New hash keys will be added, previously used hash keys (i.e. default configuration, previously run sources) will be replaced.
key%
--key name=value
If the value if an array reference, the key@ directive is used, and options are configured as --key value --key value. An array entered by this source will replace a previously entered array (i.e. default configuration, previous run sources).
key@
--key value --key value
All other situations will result in a simple string, key=s.
key=s
my $config = Config::Layered->load_config( sources => [ 'ConfigAny' => { file => "/etc/myapp" } ], default => { foo => "bar", blee => 1, size => 20, bax => { chicken => "eggs", } baz => [ wq( foo bar blee ) ] } );
The above data structure would create the following Getopt::Long configuration:
Getopts( \%config, "foo=s", "blee!", "size", "bax%", "baz@", );
None
1 POD Error
The following errors were encountered while parsing the POD:
You forgot a '=back' before '=head1'
To install Config::Layered, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Config::Layered
CPAN shell
perl -MCPAN -e shell install Config::Layered
For more information on module installation, please visit the detailed CPAN module installation guide.