Linux and UNIX Man Pages

Linux & Unix Commands - Search Man Pages

config::general::interpolated(3pm) [debian man page]

General::Interpolated(3pm)				User Contributed Perl Documentation				General::Interpolated(3pm)

NAME
Config::General::Interpolated - Parse variables within Config files SYNOPSIS
use Config::General; $conf = new Config::General( -ConfigFile => 'configfile', -InterPolateVars => 1 ); DESCRIPTION
This is an internal module which makes it possible to interpolate Perl style variables in your config file (i.e. $variable or "${variable}"). Normally you don't call it directly. VARIABLES
Variables can be defined everywhere in the config and can be used afterwards as the value of an option. Variables cannot be used as keys or as part of keys. If you define a variable inside a block or a named block then it is only visible within this block or within blocks which are defined inside this block. Well - let's take a look to an example: # sample config which uses variables basedir = /opt/ora user = t_space sys = unix <table intern> instance = INTERN owner = $user # "t_space" logdir = $basedir/log # "/opt/ora/log" sys = macos <procs> misc1 = ${sys}_${instance} # macos_INTERN misc2 = $user # "t_space" </procs> </table> This will result in the following structure: { 'basedir' => '/opt/ora', 'user' => 't_space' 'sys' => 'unix', 'table' => { 'intern' => { 'sys' => 'macos', 'logdir' => '/opt/ora/log', 'instance' => 'INTERN', 'owner' => 't_space', 'procs' => { 'misc1' => 'macos_INTERN', 'misc2' => 't_space' } } } As you can see, the variable sys has been defined twice. Inside the <procs> block a variable ${sys} has been used, which then were interpolated into the value of sys defined inside the <table> block, not the sys variable one level above. If sys were not defined inside the <table> block then the "global" variable sys would have been used instead with the value of "unix". Variables inside double quotes will be interpolated, but variables inside single quotes will not interpolated. This is the same behavior as you know of Perl itself. In addition you can surround variable names with curly braces to avoid misinterpretation by the parser. SEE ALSO
Config::General AUTHORS
Thomas Linden <tlinden |AT| cpan.org> Autrijus Tang <autrijus@autrijus.org> Wei-Hon Chen <plasmaball@pchome.com.tw> COPYRIGHT
Copyright 2001 by Wei-Hon Chen <plasmaball@pchome.com.tw>. Copyright 2002-2010 by Thomas Linden <tlinden |AT| cpan.org>. This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself. See <http://www.perl.com/perl/misc/Artistic.html> VERSION
2.14 perl v5.10.1 2010-12-01 General::Interpolated(3pm)

Check Out this Related Man Page

Nagios::Plugin::Config(3pm)				User Contributed Perl Documentation			       Nagios::Plugin::Config(3pm)

NAME
Nagios::Plugin::Config - read nagios plugin .ini style config files SYNOPSIS
# Read given nagios plugin config file $Config = Nagios::Plugin::Config->read( '/etc/nagios/plugins.ini' ); # Search for and read default nagios plugin config file $Config = Nagios::Plugin::Config->read(); # Access sections and properties (returns scalars or arrayrefs) $rootproperty = $Config->{_}->{rootproperty}; $one = $Config->{section}->{one}; $Foo = $Config->{section}->{Foo}; DESCRIPTION
Nagios::Plugin::Config is a subclass of the excellent Config::Tiny, with the following changes: o Repeated keys are allowed within sections, returning lists instead of scalars o Write functionality has been removed i.e. access is read only o Nagios::Plugin::Config searches for a default nagios plugins file if no explicit filename is given to "read()". The current standard locations checked are: /etc/nagios/plugins.ini /usr/local/nagios/etc/plugins.ini /usr/local/etc/nagios /etc/opt/nagios/plugins.ini /etc/nagios-plugins.ini /usr/local/etc/nagios-plugins.ini /etc/opt/nagios-plugins.ini To use a custom location, set a "NAGIOS_CONFIG_PATH" environment variable to the set of directories that should be checked. The first "plugins.ini" or "nagios-plugins.ini" file found will be used. SEE ALSO
Config::Tiny, Nagios::Plugin AUTHORS
This code is maintained by the Nagios Plugin Development Team: <http://nagiosplug.sourceforge.net>. COPYRIGHT and LICENCE Copyright (C) 2006-2007 by Nagios Plugin Development Team This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.14.2 2010-12-03 Nagios::Plugin::Config(3pm)
Man Page