diff options
-rw-r--r-- | CHANGES | 1 | ||||
-rw-r--r-- | CONTRIBUTORS | 2 | ||||
-rw-r--r-- | Makefile | 10 | ||||
-rw-r--r-- | doc/smokeping_extend.pod | 10 | ||||
-rw-r--r-- | lib/Config/Grammar.pm (renamed from lib/ISG/ParseConfig.pm) | 59 | ||||
-rw-r--r-- | lib/Smokeping.pm | 8 |
6 files changed, 35 insertions, 55 deletions
@@ -1,3 +1,4 @@ +* change ISG::ParseConfig references to its new name, Config::Grammar -- niko * don't create any RRD files if running as a CGI -- niko * Curl timeouts work better now -- niko, reported by Chris Wilson <chris *aidworld.org> * Curl User-Agent string doesn't need quotes anymore -- niko diff --git a/CONTRIBUTORS b/CONTRIBUTORS index d801601..c9d0ed6 100644 --- a/CONTRIBUTORS +++ b/CONTRIBUTORS @@ -5,5 +5,5 @@ Contributors * Niko Tyni <ntyni@iki.fi> => Many Patches * Simon Leinen <leinen@switch.ch> => SNMP_Session.pm -* David Schweikert <dws@ee.ethz.ch> => ISG::ParseConfig.pm +* David Schweikert <dws@ee.ethz.ch> => Config::Grammar * Jack Cummings <jack@mudshark.org> => Proper graphs with pings > 10s. @@ -9,7 +9,7 @@ GROFF = groff DOCS = $(filter-out doc/smokeping_config.pod doc/smokeping.pod doc/smokeping.cgi.pod,$(wildcard doc/*.pod)) doc/smokeping_examples.pod # section 7 DOCSCONFIG := doc/smokeping_config.pod # section 5 -PM := lib/ISG/ParseConfig.pm lib/Smokeping.pm lib/Smokeping/Examples.pm lib/Smokeping/RRDtools.pm +PM := lib/Config/Grammar.pm lib/Smokeping.pm lib/Smokeping/Examples.pm lib/Smokeping/RRDtools.pm PODPROBE := $(wildcard lib/Smokeping/probes/*.pm) PODMATCH := $(wildcard lib/Smokeping/matchers/*.pm) @@ -53,7 +53,7 @@ doc/Smokeping/probes/%.3: doc/Smokeping/probes/%.pod $(POD2MAN) --section 3 > $@ doc/Smokeping/matchers/%.3: lib/Smokeping/matchers/%.pm $(POD2MAN) --section 3 > $@ -doc/ISG/%.3: lib/ISG/%.pm +doc/Config/%.3: lib/Config/%.pm $(POD2MAN) --section 3 > $@ doc/smokeping.1: bin/smokeping.dist $(POD2MAN) --section 1 > $@ @@ -71,7 +71,7 @@ doc/Smokeping/RRDtools.html: lib/Smokeping/RRDtools.pm doc/Smokeping/matchers/%.html: lib/Smokeping/matchers/%.pm $(POD2HTML) -doc/ISG/%.html: lib/ISG/%.pm +doc/Config/%.html: lib/Config/%.pm $(POD2HTML) doc/smokeping.html: bin/smokeping.dist $(POD2HTML) @@ -99,7 +99,7 @@ rename-man: $(MAN) mv $$i `echo $$i | sed s,$$j/,$$j/Smokeping::$$j::,`; \ done; \ done - mv doc/ISG/ParseConfig.3 doc/ISG/ISG::ParseConfig.3 + mv doc/Config/Grammar.3 doc/Config/Config::Grammar.3 mv doc/Smokeping/Examples.3 doc/Smokeping/Smokeping::Examples.3 mv doc/Smokeping/RRDtools.3 doc/Smokeping/Smokeping::RRDtools.3 @@ -128,7 +128,7 @@ patch: perl -i~ -p -e 's/Smokeping \d.*?;/Smokeping $(NUMVERSION);/' bin/smokeping.dist htdocs/smokeping.cgi.dist killdoc: - -rm doc/*.[1357] doc/*.txt doc/*.html doc/Smokeping/* doc/Smokeping/probes/* doc/Smokeping/matchers/* doc/ISG/* doc/examples/* doc/smokeping_examples.pod doc/smokeping_config.pod doc/smokeping.pod doc/smokeping.cgi.pod + -rm doc/*.[1357] doc/*.txt doc/*.html doc/Smokeping/* doc/Smokeping/probes/* doc/Smokeping/matchers/* doc/Config/* doc/examples/* doc/smokeping_examples.pod doc/smokeping_config.pod doc/smokeping.pod doc/smokeping.cgi.pod doc: killdoc ref examples man html txt rename-man diff --git a/doc/smokeping_extend.pod b/doc/smokeping_extend.pod index 402efac..0a0eb41 100644 --- a/doc/smokeping_extend.pod +++ b/doc/smokeping_extend.pod @@ -94,13 +94,13 @@ convenience method called C<_makevars> that does this, and the common idiom is } The variables are declared in a syntax that comes from the module used -for parsing the configuration file, C<ISG::ParseConfig>. Each variable +for parsing the configuration file, C<Config::Grammar>. Each variable should be a hash that uses the "special variable keys" documented in -L<ISG::ParseConfig>. See C<Smokeping::probes::skel> and the other +L<Config::Grammar>. See C<Smokeping::probes::skel> and the other probes for examples. For reference, here are the keys the hash should have. Much of this -is taken straight from the C<ISG::ParseConfig> manual. +is taken straight from the C<Config::Grammar> manual. =over @@ -150,11 +150,11 @@ the returned string as content. The C<probevars> and C<targetvars> methods should return hash references that contain the variable names as keys and the hashes described above -as values. In addition the C<ISG::ParseConfig> special section key +as values. In addition the C<Config::Grammar> special section key C<_mandatory> is supported and should contain a reference to a list of mandatory variables. The C<_makevars> method is available of this special key and merges the mandatory lists in its arguments. Note that no other -C<ISG::ParseConfig> special section keys are supported. +C<Config::Grammar> special section keys are supported. =head1 INITIALIZATION diff --git a/lib/ISG/ParseConfig.pm b/lib/Config/Grammar.pm index 824ea79..ede1a48 100644 --- a/lib/ISG/ParseConfig.pm +++ b/lib/Config/Grammar.pm @@ -1,4 +1,4 @@ -package ISG::ParseConfig; +package Config::Grammar; # TODO: # - _order for sections @@ -6,7 +6,7 @@ package ISG::ParseConfig; use strict; use vars qw($VERSION); -$VERSION = 2.0; +$VERSION = '1.01'; sub new($$) { @@ -1039,26 +1039,26 @@ __END__ =head1 NAME -ISG::ParseConfig - Simple config parser +Config::Grammar - A grammar-based, user-friendly config parser =head1 SYNOPSIS - use ISG::ParseConfig; + use Config::Grammar; - my $parser = ISG::ParseConfig->new(\%grammar); + my $parser = Config::Grammar->new(\%grammar); my $cfg = $parser->parse('app.cfg') or die "ERROR: $parser->{err}\n"; my $pod = $parser->makepod(); my $ex = $parser->maketmpl('TOP','SubNode'); =head1 DESCRIPTION -ISG::ParseConfig is a module to parse configuration files. The +Config::Grammar is a module to parse configuration files. The configuration may consist of multiple-level sections with assignments and tabular data. The parsed data will be returned as a hash -containing the whole configuration. ISG::ParseConfig uses a grammar -that is supplied upon creation of a ISG::ParseConfig object to parse +containing the whole configuration. Config::Grammar uses a grammar +that is supplied upon creation of a Config::Grammar object to parse the configuration file and return helpful error messages in case of -syntax errors. Using the B<makepod> methode you can generate +syntax errors. Using the B<makepod> method you can generate documentation of the configuration file format. The B<maketmpl> method can generate a template configuration file. If @@ -1321,7 +1321,7 @@ be escaped with a backslash as well. =head3 Sections -ISG::ParseConfig supports hierarchical configurations through sections, whose +Config::Grammar supports hierarchical configurations through sections, whose syntax is as follows: =over 15 @@ -1358,7 +1358,7 @@ The data is interpreted as one or more columns separated by spaces. =head3 Code - my $parser = ISG::ParseConfig->new({ + my $parser = Config::Grammar->new({ _sections => [ 'network', 'hosts' ], network => { _vars => [ 'dns' ], @@ -1470,44 +1470,23 @@ The data is interpreted as one or more columns separated by spaces. =head1 COPYRIGHT -Copyright (c) 2000, 2001 by ETH Zurich. All rights reserved. +Copyright (c) 2000-2005 by ETH Zurich. All rights reserved. =head1 LICENSE -This program is free software; you can redistribute it and/or modify -it under the terms of the GNU General Public License as published by -the Free Software Foundation; either version 2 of the License, or -(at your option) any later version. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. +This program is free software; you can redistribute it and/or modify it +under the same terms as Perl itself. =head1 AUTHOR -David Schweikert E<lt>dws@ee.ethz.chE<gt>, -Tobias Oetiker E<lt>oetiker@ee.ethz.chE<gt> +David Schweikert E<lt>dws_at_ee.ethz.chE<gt>, +Tobias Oetiker E<lt>oetiker_at_ee.ethz.chE<gt>, +Niko Tyni E<lt>ntyni_at_iki.fiE<gt> =head1 HISTORY - 2001-05-11 ds 1.2 Initial Version for policy 0.3 - 2001-09-04 ds 1.3 Remove space before comments, more strict variable definition - 2001-09-19 to 1.4 Added _sub error parsing and _doc self documentation - 2001-10-20 to Improved Rendering of _doc information - 2002-01-09 to Added Documentation to the _text section documentation - 2002-01-28 to Fixed quote parsing in tables - 2002-03-12 ds 1.5 Implemented @define, make makepod return a string and not an array - 2002-08-28 to Added maketmpl methode - 2002-10-10 ds 1.6 More verbatim _text sections - 2004-02-09 to 1.7 Added _example propperty for pod and template generation - 2004-08-17 to 1.8 Allow special input files like "program|" - 2005-01-10 ds 1.9 Implemented _dyn, _default, _recursive, and _inherited (Niko Tyni) - 2005-02-21 ds 2.00 Implemented _dyndoc, _varlist and _sub for sections (Niko Tyni) + 2001-05-11 ds Initial Version of ISG::ParseConfig + 2005-03-08 ds 1.00 Renamed from ISG::ParseConfig to Config::Grammar =cut diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index 8cd5897..6718f36 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -9,7 +9,7 @@ use Digest::MD5 qw(md5_base64); use SNMP_util; use SNMP_Session; use POSIX; -use ISG::ParseConfig; +use Config::Grammar; use RRDs; use Sys::Syslog qw(:DEFAULT setlogsock); setlogsock('unix') @@ -1383,7 +1383,7 @@ DOC # if there is a subprobe, the top-level section # of this probe turns into a template, and we # need to delete its _mandatory list. - # Note that ISG::ParseConfig does mandatory checking + # Note that Config::Grammar does mandatory checking # after the whole config tree is read, so we can fiddle # here with "_mandatory" all we want. # see 1.3 above @@ -1446,7 +1446,7 @@ DOC }, }; # $PROBES - my $parser = ISG::ParseConfig->new + my $parser = Config::Grammar->new ( { _sections => [ qw(General Database Presentation Probes Alerts Targets) ], @@ -2374,7 +2374,7 @@ The contents of this manual is generated directly from the configuration file parser. The Parser for the Configuration file is written using David Schweikers -ParseConfig module. Read all about it in L<ISG::ParseConfig>. +Config::Grammar module. Read all about it in L<Config::Grammar>. The Configuration file has a tree-like structure with section headings at various levels. It also contains variable assignments and tables. |