Sophie

Sophie

distrib > Mandriva > 2010.0 > i586 > media > contrib-release > by-pkgid > d97b4c58d8763adc61a7b020afdfd868 > files > 20

smokeping-2.4.2-9mdv2010.0.noarch.rpm

.\" Automatically generated by Pod::Man v1.37, Pod::Parser v1.32
.\"
.\" Standard preamble:
.\" ========================================================================
.de Sh \" Subsection heading
.br
.if t .Sp
.ne 5
.PP
\fB\\$1\fR
.PP
..
.de Sp \" Vertical space (when we can't use .PP)
.if t .sp .5v
.if n .sp
..
.de Vb \" Begin verbatim text
.ft CW
.nf
.ne \\$1
..
.de Ve \" End verbatim text
.ft R
.fi
..
.\" Set up some character translations and predefined strings.  \*(-- will
.\" give an unbreakable dash, \*(PI will give pi, \*(L" will give a left
.\" double quote, and \*(R" will give a right double quote.  \*(C+ will
.\" give a nicer C++.  Capital omega is used to do unbreakable dashes and
.\" therefore won't be available.  \*(C` and \*(C' expand to `' in nroff,
.\" nothing in troff, for use with C<>.
.tr \(*W-
.ds C+ C\v'-.1v'\h'-1p'\s-2+\h'-1p'+\s0\v'.1v'\h'-1p'
.ie n \{\
.    ds -- \(*W-
.    ds PI pi
.    if (\n(.H=4u)&(1m=24u) .ds -- \(*W\h'-12u'\(*W\h'-12u'-\" diablo 10 pitch
.    if (\n(.H=4u)&(1m=20u) .ds -- \(*W\h'-12u'\(*W\h'-8u'-\"  diablo 12 pitch
.    ds L" ""
.    ds R" ""
.    ds C` ""
.    ds C' ""
'br\}
.el\{\
.    ds -- \|\(em\|
.    ds PI \(*p
.    ds L" ``
.    ds R" ''
'br\}
.\"
.\" If the F register is turned on, we'll generate index entries on stderr for
.\" titles (.TH), headers (.SH), subsections (.Sh), items (.Ip), and index
.\" entries marked with X<> in POD.  Of course, you'll have to process the
.\" output yourself in some meaningful fashion.
.if \nF \{\
.    de IX
.    tm Index:\\$1\t\\n%\t"\\$2"
..
.    nr % 0
.    rr F
.\}
.\"
.\" For nroff, turn off justification.  Always turn off hyphenation; it makes
.\" way too many mistakes in technical documents.
.hy 0
.if n .na
.\"
.\" Accent mark definitions (@(#)ms.acc 1.5 88/02/08 SMI; from UCB 4.2).
.\" Fear.  Run.  Save yourself.  No user-serviceable parts.
.    \" fudge factors for nroff and troff
.if n \{\
.    ds #H 0
.    ds #V .8m
.    ds #F .3m
.    ds #[ \f1
.    ds #] \fP
.\}
.if t \{\
.    ds #H ((1u-(\\\\n(.fu%2u))*.13m)
.    ds #V .6m
.    ds #F 0
.    ds #[ \&
.    ds #] \&
.\}
.    \" simple accents for nroff and troff
.if n \{\
.    ds ' \&
.    ds ` \&
.    ds ^ \&
.    ds , \&
.    ds ~ ~
.    ds /
.\}
.if t \{\
.    ds ' \\k:\h'-(\\n(.wu*8/10-\*(#H)'\'\h"|\\n:u"
.    ds ` \\k:\h'-(\\n(.wu*8/10-\*(#H)'\`\h'|\\n:u'
.    ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'^\h'|\\n:u'
.    ds , \\k:\h'-(\\n(.wu*8/10)',\h'|\\n:u'
.    ds ~ \\k:\h'-(\\n(.wu-\*(#H-.1m)'~\h'|\\n:u'
.    ds / \\k:\h'-(\\n(.wu*8/10-\*(#H)'\z\(sl\h'|\\n:u'
.\}
.    \" troff and (daisy-wheel) nroff accents
.ds : \\k:\h'-(\\n(.wu*8/10-\*(#H+.1m+\*(#F)'\v'-\*(#V'\z.\h'.2m+\*(#F'.\h'|\\n:u'\v'\*(#V'
.ds 8 \h'\*(#H'\(*b\h'-\*(#H'
.ds o \\k:\h'-(\\n(.wu+\w'\(de'u-\*(#H)/2u'\v'-.3n'\*(#[\z\(de\v'.3n'\h'|\\n:u'\*(#]
.ds d- \h'\*(#H'\(pd\h'-\w'~'u'\v'-.25m'\f2\(hy\fP\v'.25m'\h'-\*(#H'
.ds D- D\\k:\h'-\w'D'u'\v'-.11m'\z\(hy\v'.11m'\h'|\\n:u'
.ds th \*(#[\v'.3m'\s+1I\s-1\v'-.3m'\h'-(\w'I'u*2/3)'\s-1o\s+1\*(#]
.ds Th \*(#[\s+2I\s-2\h'-\w'I'u*3/5'\v'-.3m'o\v'.3m'\*(#]
.ds ae a\h'-(\w'a'u*4/10)'e
.ds Ae A\h'-(\w'A'u*4/10)'E
.    \" corrections for vroff
.if v .ds ~ \\k:\h'-(\\n(.wu*9/10-\*(#H)'\s-2\u~\d\s+2\h'|\\n:u'
.if v .ds ^ \\k:\h'-(\\n(.wu*10/11-\*(#H)'\v'-.4m'^\v'.4m'\h'|\\n:u'
.    \" for low resolution devices (crt and lpr)
.if \n(.H>23 .if \n(.V>19 \
\{\
.    ds : e
.    ds 8 ss
.    ds o a
.    ds d- d\h'-1'\(ga
.    ds D- D\h'-1'\(hy
.    ds th \o'bp'
.    ds Th \o'LP'
.    ds ae ae
.    ds Ae AE
.\}
.rm #[ #] #H #V #F C
.\" ========================================================================
.\"
.IX Title "Config::Grammar 3"
.TH Config::Grammar 3 "2007-09-26" "2.4.2" "SmokePing"
.SH "NAME"
Config::Grammar \- A grammar\-based, user\-friendly config parser
.SH "SYNOPSIS"
.IX Header "SYNOPSIS"
.Vb 1
\& use Config::Grammar;
.Ve
.PP
.Vb 5
\& my $parser = Config::Grammar\->new(\e%grammar);
\& my $cfg = $parser\->parse(\(aqapp.cfg\(aq) or die "ERROR: $parser\->{err}\en";
\& my $pod = $parser\->makepod();
\& my $ex = $parser\->maketmpl(\(aqTOP\(aq,\(aqSubNode\(aq);
\& my $minex = $parser\->maketmplmin(\(aqTOP\(aq,\(aqSubNode\(aq);
.Ve
.SH "DESCRIPTION"
.IX Header "DESCRIPTION"
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. 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 \fBmakepod\fR method you can generate
documentation of the configuration file format.
.PP
The \fBmaketmpl\fR method can generate a template configuration file.  If
your grammar contains regexp matches, the template will not be all
that helpful as Config::Grammar is not smart enough to give you sensible
template data based in regular expressions. The related function 
\&\fBmaketmplmin\fR generates a minimal configuration template without 
examples, regexps or comments and thus allows an experienced user to
fill in the configuration data more efficiently.
.Sh "Grammar Definition"
.IX Subsection "Grammar Definition"
The grammar is a multiple-level hash of hashes, which follows the structure of
the configuration. Each section or variable is represented by a hash with the
same structure.  Each hash contains special keys starting with an underscore
such as '_sections', '_vars', '_sub' or '_re' to denote meta data with information
about that section or variable. Other keys are used to structure the hash
according to the same nesting structure of the configuration itself. The
starting hash given as parameter to 'new' contains the \*(L"root section\*(R".
.PP
\fISpecial Section Keys\fR
.IX Subsection "Special Section Keys"
.IP "_sections" 12
.IX Item "_sections"
Array containing the list of sub-sections of this section. Each sub-section
must then be represented by a sub-hash in this hash with the same name of the
sub\-section.
.Sp
The sub-section can also be a regular expression denoted by the syntax '/re/',
where re is the regular\-expression. In case a regular expression is used, a
sub-hash named with the same '/re/' must be included in this hash.
.IP "_vars" 12
.IX Item "_vars"
Array containing the list of variables (assignments) in this section.
Analogous to sections, regular expressions can be used.
.IP "_mandatory" 12
.IX Item "_mandatory"
Array containing the list of mandatory sections and variables.
.IP "_inherited" 12
.IX Item "_inherited"
Array containing the list of the variables that should be assigned the
same value as in the parent section if nothing is specified here.
.IP "_table" 12
.IX Item "_table"
Hash containing the table grammar (see Special Table Keys). If not specified,
no table is allowed in this section. The grammar of the columns if specified
by sub-hashes named with the column number.
.IP "_text" 12
.IX Item "_text"
Section contains free-form text. Only sections and \f(CW@includes\fR statements will
be interpreted, the rest will be added in the returned hash under '_text' as
string.
.Sp
\&\fB_text\fR is a hash reference which can contain a \fB_re\fR and a \fB_re_error\fR key
which will be used to scrutanize the text ... if the hash is empty, all text
will be accepted.
.IP "_order" 12
.IX Item "_order"
If defined, a '_order' element will be put in every hash containing the
sections with a number that determines the order in which the sections were
defined.
.IP "_doc" 12
.IX Item "_doc"
Describes what this section is about
.IP "_sub" 12
.IX Item "_sub"
A function pointer. It is called for every instance of this section,
with the real name of the section passed as its first argument. This is
probably only useful for the regexp sections. If the function returns
a defined value it is assumed that the test was not successful and an
error is generated with the returned string as content.
.PP
\fISpecial Variable Keys\fR
.IX Subsection "Special Variable Keys"
.IP "_re" 12
.IX Item "_re"
Regular expression upon which the value will be checked.
.IP "_re_error" 12
.IX Item "_re_error"
String containing the returned error in case the regular expression doesn't
match (if not specified, a generic 'syntax error' message will be returned).
.IP "_sub" 12
.IX Item "_sub"
A function pointer. It called for every value, with the value passed as its
first argument. If the function returns a defined value it is assumed that
the test was not successful and an error is generated with the returned
string as content.
.Sp
If the '_varlist' key (see above) is defined in this section, the '_sub'
function will also receive an array reference as the second argument. The
array contains a list of those variables already defined in the same
section. This can be used to enforce the order of the variables.
.IP "_default" 12
.IX Item "_default"
A default value that will be assigned to the variable if none is specified or inherited.
.IP "_doc" 12
.IX Item "_doc"
Description of the variable.
.IP "_example" 12
.IX Item "_example"
A one line example for the content of this variable.
.PP
\fISpecial Table Keys\fR
.IX Subsection "Special Table Keys"
.IP "_columns" 12
.IX Item "_columns"
Number of columns. If not specified, it will not be enforced.
.IP "_key" 12
.IX Item "_key"
If defined, the specified column number will be used as key in a hash in the
returned hash. If not defined, the returned hash will contain a '_table'
element with the contents of the table as array. The rows of the tables are
stored as arrays.
.IP "_sub" 12
.IX Item "_sub"
they work analog to the description in the previous section.
.IP "_doc" 12
.IX Item "_doc"
describes the content of the column.
.IP "_example" 12
.IX Item "_example"
example for the content of this column
.PP
\fISpecial Text Keys\fR
.IX Subsection "Special Text Keys"
.IP "_re" 12
.IX Item "_re"
Regular expression upon which the text will be checked (everything as a single
line).
.IP "_re_error" 12
.IX Item "_re_error"
String containing the returned error in case the regular expression doesn't
match (if not specified, a generic 'syntax error' message will be returned).
.IP "_sub" 12
.IX Item "_sub"
they work analog to the description in the previous section.
.IP "_doc" 12
.IX Item "_doc"
Ditto.
.IP "_example" 12
.IX Item "_example"
Potential multi line example for the content of this text section
.Sh "Configuration Syntax"
.IX Subsection "Configuration Syntax"
\fIGeneral Syntax\fR
.IX Subsection "General Syntax"
.PP
\&'#' denotes a comment up to the end\-of\-line, empty lines are allowed and space
at the beginning and end of lines is trimmed.
.PP
\&'\e' at the end of the line marks a continued line on the next line. A single
space will be inserted between the concatenated lines.
.PP
\&'@include filename' is used to include another file. Include works relative to the
directory where the parent file is in.
.PP
\&'@define a some value' will replace all occurences of 'a' in the following text
with 'some value'.
.PP
Fields in tables that contain white space can be enclosed in either \f(CW\*(C`'\*(C'\fR or \f(CW\*(C`"\*(C'\fR.
Whitespace can also be escaped with \f(CW\*(C`\e\*(C'\fR. Quotes inside quotes are allowed but must
be escaped with a backslash as well.
.PP
\fISections\fR
.IX Subsection "Sections"
.PP
Config::Grammar supports hierarchical configurations through sections, whose
syntax is as follows:
.IP "Level 1" 15
.IX Item "Level 1"
*** section name ***
.IP "Level 2" 15
.IX Item "Level 2"
+ section name
.IP "Level 3" 15
.IX Item "Level 3"
++ section name
.IP "Level n, n>1" 15
.IX Item "Level n, n>1"
+..+ section name (number of '+' determines level)
.PP
\fIAssignments\fR
.IX Subsection "Assignments"
.PP
Assignements take the form: 'variable = value', where value can be any string
(can contain whitespaces and special characters). The spaces before and after
the equal sign are optional.
.PP
\fITabular Data\fR
.IX Subsection "Tabular Data"
.PP
The data is interpreted as one or more columns separated by spaces.
.Sh "Example"
.IX Subsection "Example"
\fICode\fR
.IX Subsection "Code"
.PP
.Vb 2
\& use Data::Dumper;
\& use Config::Grammar;
.Ve
.PP
.Vb 3
\& my $RE_IP       = \(aq\ed+\e.\ed+\e.\ed+\e.\ed+\(aq;
\& my $RE_MAC      = \(aq[0\-9a\-f]{2}(?::[0\-9a\-f]{2}){5}\(aq;
\& my $RE_HOST     = \(aq\eS+\(aq;
.Ve
.PP
.Vb 58
\& my $parser = Config::Grammar\->new({
\&   _sections => [ \(aqnetwork\(aq, \(aqhosts\(aq ],
\&   network => {
\&      _vars     => [ \(aqdns\(aq ],
\&      _sections => [ "/$RE_IP/" ],
\&      dns       => {
\&         _doc => "address of the dns server",
\&         _example => "ns1.oetiker.xs",
\&         _re => $RE_HOST,
\&         _re_error =>
\&            \(aqdns must be an host name or ip address\(aq,
\&         },
\&      "/$RE_IP/" => {
\&         _doc    => "Ip Adress",
\&         _example => \(aq10.2.3.2\(aq,
\&         _vars   => [ \(aqnetmask\(aq, \(aqgateway\(aq ],
\&         netmask => {
\&            _doc => "Netmask",
\&            _example => "255.255.255.0",
\&            _re => $RE_IP,
\&            _re_error =>
\&               \(aqnetmask must be a dotted ip address\(aq
\&            },
\&         gateway => {
\&            _doc => "Default Gateway address in IP notation",
\&            _example => "10.22.12.1",
\&            _re => $RE_IP,
\&            _re_error =>
\&               \(aqgateway must be a dotted ip address\(aq },
\&         },
\&      },
\&   hosts => {
\&      _doc => "Details about the hosts",
\&      _table  => {
\&          _doc => "Description of all the Hosts",
\&         _key => 0,
\&         _columns => 3,
\&         0 => {
\&            _doc => "Ethernet Address",
\&            _example => "0:3:3:d:a:3:dd:a:cd",
\&            _re => $RE_MAC,
\&            _re_error =>
\&               \(aqfirst column must be an ethernet mac address\(aq,
\&            },
\&         1 => {
\&            _doc => "IP Address",
\&            _example => "10.11.23.1",
\&            _re => $RE_IP,
\&            _re_error =>
\&               \(aqsecond column must be a dotted ip address\(aq,
\&            },
\&         2 => {
\&            _doc => "Host Name",
\&            _example => "tardis",
\&             },
\&         },
\&      },
\&   });
.Ve
.PP
.Vb 4
\& my $cfg = $parser\->parse(\(aqtest.cfg\(aq) or
\&   die "ERROR: $parser\->{err}\en";
\& print Dumper($cfg);
\& print $parser\->makepod;
.Ve
.PP
\fIConfiguration\fR
.IX Subsection "Configuration"
.PP
.Vb 1
\& *** network ***
.Ve
.PP
.Vb 1
\&   dns      = 192.168.7.87
.Ve
.PP
.Vb 1
\& + 192.168.7.64
.Ve
.PP
.Vb 2
\&   netmask  = 255.255.255.192
\&   gateway  = 192.168.7.65
.Ve
.PP
.Vb 1
\& *** hosts ***
.Ve
.PP
.Vb 3
\&   00:50:fe:bc:65:11     192.168.7.97    plain.hades
\&   00:50:fe:bc:65:12     192.168.7.98    isg.ee.hades
\&   00:50:fe:bc:65:14     192.168.7.99    isg.ee.hades
.Ve
.PP
\fIResult\fR
.IX Subsection "Result"
.PP
.Vb 26
\& {
\&   \(aqhosts\(aq => {
\&                \(aq00:50:fe:bc:65:11\(aq => [
\&                                         \(aq00:50:fe:bc:65:11\(aq,
\&                                         \(aq192.168.7.97\(aq,
\&                                         \(aqplain.hades\(aq
\&                                       ],
\&                \(aq00:50:fe:bc:65:12\(aq => [
\&                                         \(aq00:50:fe:bc:65:12\(aq,
\&                                         \(aq192.168.7.98\(aq,
\&                                         \(aqisg.ee.hades\(aq
\&                                       ],
\&                \(aq00:50:fe:bc:65:14\(aq => [
\&                                         \(aq00:50:fe:bc:65:14\(aq,
\&                                         \(aq192.168.7.99\(aq,
\&                                         \(aqisg.ee.hades\(aq
\&                                       ]
\&              },
\&   \(aqnetwork\(aq => {
\&                  \(aq192.168.7.64\(aq => {
\&                                      \(aqnetmask\(aq => \(aq255.255.255.192\(aq,
\&                                      \(aqgateway\(aq => \(aq192.168.7.65\(aq
\&                                    },
\&                  \(aqdns\(aq => \(aq192.168.7.87\(aq
\&                }
\& };
.Ve
.SH "SEE ALSO"
.IX Header "SEE ALSO"
Config::Grammar::Dynamic
.SH "COPYRIGHT"
.IX Header "COPYRIGHT"
Copyright (c) 2000\-2005 by \s-1ETH\s0 Zurich. All rights reserved.
Copyright (c) 2007 by David Schweikert. All rights reserved.
.SH "LICENSE"
.IX Header "LICENSE"
This program is free software; you can redistribute it and/or modify it
under the same terms as Perl itself.
.SH "AUTHORS"
.IX Header "AUTHORS"
David Schweikert,
Tobias Oetiker,
Niko Tyni