1Mon::Protocol(3)      User Contributed Perl Documentation     Mon::Protocol(3)
2
3
4

NAME

6       Mon::Protocol - Methods for parsing / dumping a protocol block
7

SYNOPSIS

9           use Mon::Protocol;
10

DESCRIPTION

METHODS

13       new Creates a new object. A hash can be supplied which sets the default
14           values. An example which contains all of the variables that you can
15           initialize:
16
17               $c = new Mon::Protocol;
18
19       dump_data
20           Returns the current internal structure as a string dump suitable
21           for passing to "parse_data".
22
23       "parse_data"
24           Parses a command block (from begin_block to end_block), as
25           generated by dump_data.
26
27       "type"(new_type)
28           Sets or returns the type of the current command block. See @TYPES
29           for valid type codes.
30
31           In the future, it is possible that this module will perform
32           additional checking based on the type, for now it is left to the
33           application to interpret this.
34
35       "get_section_list"
36           Returns an array containing all section names within the block.
37
38       "get_section"(section_name)
39           Returns a hash containing the key/value pairs of the specific
40           section.
41
42       "delete_section"(section_name)
43           Completely removes the specified section from the block.
44
45       "add_to_section"(section_name,$hash_ref)
46           Adds the key/value pairs in the hash to the specified section.
47
48                   $foo->add_to_section("_hostgroup", { "ns1.baz.com" -> "ok" });
49
50       "delete_from_section"(section_name,$key)
51           Deletes the key/value pair from the section.
52
53                   $foo->delete_from_section("_hostgroup", "ns1.baz.com");
54
55       "error"
56           Should any of the functions return an error (-1), this function can
57           be used to retrieve a more elaborate error message and to reset the
58           internal error state.
59
60
61
62perl v5.38.0                      2023-07-20                  Mon::Protocol(3)
Impressum