NAME
Chronicle::Config::Reader - Simple configuration file reader.
SYNOPSIS
use strict;
use warnings;
use Chronicle::Config::Reader;
my %config;
my $helper = Chronicle::Config::Reader->new();
$helper->parseFile( \%config, "/etc/foo.rc" );
DESCRIPTION
This module is contains the code required to read a chronicle configuration file. The configuration files it reads are simple files consisting of lines which are of the form "key=value".
Additional features include:
- Comment Handling
-
Comments are begun with the
#
character and continue to the end of the line.Comments may occur at the start, middle, or end of a line.
- Environmental variable expansion
-
Environmental variables are expanded if they are detected.
- Command-execution and expansion
-
If backticks are found in configuration values they will be replaced with the output of the specified command.
The following snippet demonstrates these features:
# The path variable will be set to /bin:/sbin:...
path = $PATH
# Our hostname will be set
hostname = `hostname`
METHODS
Now follows documentation on the available methods.
new
This is the constructor, no arguments are required or expected.
parseFile
Parse a configuration file, and insert any values into the provided hash-reference.
parseLine
Parse a single line.