App-Chronicle
view release on metacpan or search on metacpan
lib/Chronicle/Config/Reader.pm view on Meta::CPAN
=head1 NAME
Chronicle::Config::Reader - Simple configuration file reader.
=head1 SYNOPSIS
use strict;
use warnings;
use Chronicle::Config::Reader;
my %config;
my $helper = Chronicle::Config::Reader->new();
$helper->parseFile( \%config, "/etc/foo.rc" );
=cut
=head1 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:
=over 8
=item Comment Handling
Comments are begun with the C<#> character and continue to the end of the line.
Comments may occur at the start, middle, or end of a line.
=item Environmental variable expansion
Environmental variables are expanded if they are detected.
=item Command-execution and expansion
If backticks are found in configuration values they will be replaced with the output of the specified command.
=back
The following snippet demonstrates these features:
=for example begin
# The path variable will be set to /bin:/sbin:...
path = $PATH
# Our hostname will be set
hostname = `hostname`
=for example end
=cut
=head1 METHODS
Now follows documentation on the available methods.
=cut
package Chronicle::Config::Reader;
use strict;
use warnings;
our $VERSION = "5.1.7";
=head2 new
This is the constructor, no arguments are required or expected.
=cut
sub new
{
my ($proto) = (@_);
my $class = ref($proto) || $proto;
my $self = {};
bless( $self, $class );
return $self;
}
=head2 parseFile
Parse a configuration file, and insert any values into the provided
hash-reference.
( run in 1.096 second using v1.01-cache-2.11-cpan-5b529ec07f3 )