Activator::Config

Provides a merged configuration to a script combining command-line options, environment variables, and configuration files.
Download

Activator::Config Ranking & Summary

Advertisement

  • Rating:
  • License:
  • Perl Artistic License
  • Price:
  • FREE
  • Publisher Name:
  • Karim A. Nassar
  • Publisher web site:
  • http://search.cpan.org/~knassar/

Activator::Config Tags


Activator::Config Description

Provides a merged configuration to a script combining command-line options, environment variables, and configuration files. Activator::Config is a Perl module that provides a merged configuration to a script combining command-line options, environment variables, and configuration files.SYNOPSIS use Activator::Config; my $config = Activator::Config->get_config( @ARGV); # default realm my $config = Activator::Config->get_config( @ARGV, $otherrealm); #### Get a hashref of command line arguments, and an arrayref of bareword arguments my ( $config, $args ) = Activator::Config->get_args( @ARGV );This module allows a script or application to have a complex configuration combining options from command line, environment variables, and YAML configuration files.For a script or application, one creates any number of YAML configuration files. These files will be deterministically merged into one hash. You can then pass this to an application or write it to file.This module is not an options validator. It uses command line options as overrides to existing keys in configuration files and DOES NOT validate them. Unrecognized command line options are ignored and @ARGV is modified to remove recognized options, leaving barewords and unrecognized options in place and the same order for a real options validator (like Getopt::Long). If you do use another options module, make sure you call get_config() BEFORE you call their processor, so that @ARGV will be in an appropriate state.Environment variables can be used to act as a default to command line options, and/or override any top level configuration file key which is a scalar.This module is cool because:* You can generate merged, complex configuration heirarchies that are context sensitive very easily.* You can pass as complex a config as you like to any script or application, and override any scalar configuration option with your environment variables or from the command line.* It supports realms, allowing you to have default configurations for development, QA, production, or any number of arbitrary realms you desire. That is, with a simple command line flag, you can switch your configuration context. Requirements: · Perl


Activator::Config Related Software