NAME
ConfigReader::Simple - Simple configuration file parser
SYNOPSIS
use ConfigReader::Simple;
$config = ConfigReader::Simple->new("configrc", [qw(Foo Bar Baz Quux)]);
$config->parse();
$config->get("Foo");
DESCRIPTION
C<ConfigReader::Simple> reads and parses simple configuration files. It's
designed to be smaller and simpler than the C<ConfigReader> module
and is more suited to simple configuration files.
CONSTRUCTOR
- new ( FILENAME, DIRECTIVES )
-
This is the constructor for a new ConfigReader::Simple object.
FILENAME
tells the instance where to look for the configuration file.DIRECTIVES
is an optional argument and is a reference to an array. Each member of the array should contain one valid directive. A directive is the name of a key that must occur in the configuration file. If it is not found, the module will die. The directive list may contain all the keys in the configuration file, a sub set of keys or no keys at all.This does the actual work. No parameters needed.
Returns the parsed value for that directive.
- _validate_keys ( )
-
If any keys were declared when the object was constructed, check that those keys actually occur in the configuration file.
LIMITATIONS/BUGS
Directives are case-sensitive.
If a directive is repeated, the first instance will silently be ignored.
Always die()s on errors instead of reporting them.
get()
doesn't warn if used before parse()
.
get()
doesn't warn if you try to acces the value of an unknown directive not know (ie: one that wasn't passed via new()
).
All these will be addressed in future releases.
CREDITS
Kim Ryan <kimaryan@ozemail.com.au> adapted the module to make declaring keys optional. Thanks Kim.
AUTHORS
Bek Oberin <gossamer@tertius.net.au>
COPYRIGHT
Copyright (c) 2000 Bek Oberin. All rights reserved.
This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
4 POD Errors
The following errors were encountered while parsing the POD:
- Around line 55:
'=item' outside of any '=over'
- Around line 95:
=pod directives shouldn't be over one line long! Ignoring all 2 lines of content
- Around line 127:
=pod directives shouldn't be over one line long! Ignoring all 2 lines of content
- Around line 192:
You forgot a '=back' before '=head1'