Debian Codegraph @

README

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