Config::IniFiles 2.38 review

Download
by rbytes.net on

Config::IniFiles is a module for reading .ini-style configuration files. SYNOPSIS use Config::IniFiles; my $cfg = new Conf

License: Perl Artistic License
File size: 35K
Developer: Scott Hutton
0 stars award from rbytes.net

Config::IniFiles is a module for reading .ini-style configuration files.

SYNOPSIS

use Config::IniFiles;
my $cfg = new Config::IniFiles( -file => "/path/configfile.ini" );
print "The value is " . $cfg->val( 'Section', 'Parameter' ) . "."
if $cfg->val( 'Section', 'Parameter' );

Config::IniFiles provides a way to have readable configuration files outside your Perl script. Configurations can be imported (inherited, stacked,...), sections can be grouped, and settings can be accessed from a tied hash.

FILE FORMAT

INI files consist of a number of sections, each preceded with the section name in square brackets. The first non-blank character of the line indicating a section must be a left bracket and the last non-blank character of a line indicating a section must be a right bracket. The characters making up the section name can be any symbols at all. However section names must be unique.

Parameters are specified in each section as Name=Value. Any spaces around the equals sign will be ignored, and the value extends to the end of the line. Parameter names are localized to the namespace of the section, but must be unique within a section.

[section]
Parameter=Value

Both the hash mark (#) and the semicolon (;) are comment characters. by default (this can be changed by configuration) Lines that begin with either of these characters will be ignored. Any amount of whitespace may precede the comment character.

Multi-line or multi-valued parameters may also be defined ala UNIX "here document" syntax:

Parameter=

Config::IniFiles 2.38 keywords