From 4afa8d737f18a3a1241a8b71f96d28b7fdb1ffa5 Mon Sep 17 00:00:00 2001 From: Tobi Oetiker Date: Sun, 22 Oct 2006 22:13:11 +0000 Subject: allow . in section names --- lib/Smokeping.pm | 29 ++++++++++++++--------------- 1 file changed, 14 insertions(+), 15 deletions(-) (limited to 'lib') diff --git a/lib/Smokeping.pm b/lib/Smokeping.pm index b64c50a..04e320d 100644 --- a/lib/Smokeping.pm +++ b/lib/Smokeping.pm @@ -28,7 +28,7 @@ use Smokeping::RRDtools; # globale persistent variables for speedy use vars qw($cfg $probes $VERSION $havegetaddrinfo $cgimode); -$VERSION="2.000906"; +$VERSION="2.000907"; # we want opts everywhere my %opt; @@ -1322,7 +1322,6 @@ sub get_parser () { # current 'probe' setting. - my $KEY_RE = '[-_0-9a-zA-Z]+'; my $KEYD_RE = '[-_0-9a-zA-Z.]+'; my $PROBE_RE = '[A-Z][a-zA-Z]+'; my $e = "="; @@ -1366,15 +1365,15 @@ sub get_parser () { { _vars => $TARGETCOMMONVARS, _inherited=> [ qw (probe alerts alertee) ], - _sections => [ "/$KEY_RE/" ], - _recursive=> [ "/$KEY_RE/" ], + _sections => [ "/$KEYD_RE/" ], + _recursive=> [ "/$KEYD_RE/" ], _sub => sub { my $val = shift; return "PROBE_CONF sections are neither needed nor supported any longer. Please see the smokeping_upgrade document." if $val eq 'PROBE_CONF'; return undef; }, - "/$KEY_RE/" => {}, + "/$KEYD_RE/" => {}, _order => 1, _varlist => 1, _doc => <{"/$KEY_RE/"} = $g; + $grammar->{"/$KEYD_RE/"} = $g; push @{$g->{_inherited}}, @targetvars; # this makes the variables mandatory only in those sections @@ -1586,7 +1585,7 @@ DOC $grammar->{_mandatory} = [ @mandatory ]; # do it for probe instances in subsections too - my $g = $grammar->{"/$KEY_RE/"}; + my $g = $grammar->{"/$KEYD_RE/"}; for (@probevars) { $grammar->{$_} = $probevars->{$_}; %{$g->{$_}} = %{$probevars->{$_}}; @@ -1655,8 +1654,8 @@ DOC } }, _dyndoc => $probelist, # all available probes - _sections => [ "/$KEY_RE/" ], - "/$KEY_RE/" => { + _sections => [ "/$KEYD_RE/" ], + "/$KEYD_RE/" => { _doc => < { _sections => [ "/$KEY_RE/" ], + Probes => { _sections => [ "/$KEYD_RE/" ], _doc => < $PROBES, + "/$KEYD_RE/" => $PROBES, }, Alerts => { _doc => < [ qw(probe menu title remark alerts) ], _mandatory => [ qw(probe menu title) ], _order => 1, - _sections => [ "/$KEY_RE/" ], - _recursive => [ "/$KEY_RE/" ], - "/$KEY_RE/" => $TARGETCOMMON, # this is just for documentation, _dyn() below replaces it + _sections => [ "/$KEYD_RE/" ], + _recursive => [ "/$KEYD_RE/" ], + "/$KEYD_RE/" => $TARGETCOMMON, # this is just for documentation, _dyn() below replaces it probe => { _doc => <{_vars}}, @targetvars; my $g = { %{_deepcopy($TARGETCOMMON)}, %{_deepcopy($targetvars)} }; - $grammar->{"/$KEY_RE/"} = $g; + $grammar->{"/$KEYD_RE/"} = $g; $g->{_vars} = [ @{$g->{_vars}}, @targetvars ]; $g->{_inherited} = [ @{$g->{_inherited}}, @targetvars ]; # this makes the reference manual a bit less cluttered -- cgit v1.2.3-24-g4f1b