1CONFIGREADER(1)       User Contributed Perl Documentation      CONFIGREADER(1)
2
3
4

NAME

6       ConfigReader - Read directives from a configuration file.
7

DESCRIPTION

9       The ConfigReader library is a set of classes which reads directives
10       from a configuration file.  The library is completely object oriented,
11       and it is envisioned that parsers for new styles of configuration files
12       can be easily added.
13
14       ConfigReader::Spec encapsulates a specification for configuration
15       directives.  You can specify which directives can be in the
16       configuration file, aliases for the directive, whether the directive is
17       required or has a default value, and how to parse the directive value.
18
19       Here's an example of how one directive might be specified:
20
21            required $spec 'HomePage', 'new URI::URL';
22
23       This defines a required directive called 'HomePage'.  To parse the
24       value from the configuration file, the URI::URL::new() method will be
25       called with the string value as its argument.
26
27       If the directive name is a simple string, it will be used both to refer
28       to the directive in the Perl program, and as the name in the
29       configuration file.  You can also specify an alias by using an array
30       ref.  For example, suppose you wanted to use "index" as the name of the
31       directive in the configuration file, but to avoid confusion with Perl's
32       index() function you wanted to refer to the directive inside the
33       program as the "file_index".  This will do the trick:
34
35           ['file_index', 'index']
36
37       You can specify any number of aliases for the directive:
38
39           ['file_index', 'index', 'file_index', 'contents', ...]
40
41       The parsing function or method is called to translate the value string
42       from the configuration file into the value used by the program.  It can
43       be specified in several different ways:
44
45       code ref static method object method undefined
46
47       You can also specify a default value to be used if a directive is not
48       specified in the configuration file.
49
50       string value code ref undefined
51
52       ConfigReader::Values stores a set of directive values that have been
53       read from a configuration file.  It stores a reference to an associated
54       Spec as a member variable.  Separating the specification from the
55       values makes it possible to use a single specification for multiple
56       sets of values.
57
58       ConfigReader::DirectiveStyle implements a reader for a common style of
59       configuration file.  It is a subclass of ConfigReader::Values.
60       Directive names are followed by their value, one per line:
61
62           HomePage   http://www.w3.org/
63           Services   /etc/services
64
65
66
67perl v5.28.1                      1996-02-14                   CONFIGREADER(1)
Impressum