• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

ConfigReader.podH A D14-Feb-19962.4 KiB6949

DirectiveStyle.pmH A D19-Feb-19968.9 KiB300117

READMEH A D19-Feb-19962.1 KiB5846

Spec.pmH A D19-Feb-19969.5 KiB347248

Values.pmH A D19-Feb-19967.4 KiB27677

README

1This is ConfigReader 0.5.  I'm calling it an alpha release, as I'd
2like to get feedback on the interface.
3
4ConfigReader is a set of classes for reading configuration files.  The
5programmer can easily specify the directives to be read, as well as
6their default values and a parsing function or method to use.  A lot
7of work went into error handling.  The class implementation means that
8a simple subclass can be written to parse a different style of
9configuration file, and it will automatically get the specifying,
10error handling, and parser features of ConfigReader.
11
12You'll find documentation in ConfigReader.pod, as well as in the
13source files.  The *.pm files should be installed in a "ConfigReader"
14subdirectory on your Perl include path.
15
16Copyright terms are under the GLPL (the GNU *Library* Public License
17which is less restrictive than the more well known GPL.  I like the
18GLPL, as I think it does a good job of expressing my wish that the
19end-user can see and use my source code, without restricting the rest
20of the program.
21
22But please let me know if the GLPL would cause a problem for you.
23(Especially if you'd like to write some additional ConfigReader
24subclasses :-).
25
26There is one point of terminology in the documentation which I
27now realize is confusing.  The config file parser class specifies the
28syntax of how directives and values are written in the config file:
29
30    Verbose yes
31    Verbose=yes
32    {Verbose => 'yes'}
33
34The programmer can create a "parsing function or method", which
35converts a string representation into a Perl value (or object).  This
36code can than be used transparently with any of the file parsing
37classes.
38
39    sub yes_no {
40        my ($val) = @_;
41        if ($val =~ m/^y/i) {
42            return 1;
43        } else {
44            return 0;
45        }
46    }
47
48    directive $c, 'Verbose', undef, \&yes_no;
49    directive $c, 'HomePage', undef, 'new URI::URL';
50
51I think it might be clearer if "parsing" where used for parsing the
52configuration file into directive and value string pairs, and the
53"parsing function or method" was called something else.  Suggestions
54are welcome.
55
56Andrew Wilcox
57awilcox@world.std.com
58