Mon::Protocol(3pm)
π¦ NAME
okay so bestie, meet Mon::Protocol β it's literally Methods for parsing / dumping a protocol block. that's the whole vibe π
β¨ SYNOPSIS
use Mon::Protocol;
that's it. that's the whole setup. iconic behavior honestly π
π DESCRIPTION
soooo this section of the og page is justβ¦ blank πΈ nothing here. no cap, it's giving mysterious. we move on, the methods are where the party's at π
πΈ METHODS
new
creates a brand new object for you, fresh out the box β¨ you can hand it a hash and that hash sets your default values. here's an example with literally every variable you're allowed to initialize:
$c = new Mon::Protocol;
dump_data
hands you back your current internal structure as a string dump β and that dump is formatted so you can feed it straight into parse_data. round trip, slay π«
parse_data
parses a command block for you, going from begin_block all the way to end_block, exactly the way dump_data would have generated it. so likeβ¦ the inverse of dump_data, bestie π«Ά
type(new_type)
sets or returns the type of the current command block. for valid type codes, go look at @TYPES π
and here's the tea: in the future it's possible this module will do extra checking based on the type. but for now? nope. it's left to the application to interpret this. so don't come for the module, it's just not that girl yet π
get_section_list
returns an array holding all the section names inside the block. all of them. every single one π
get_section(section_name)
returns a hash containing the key/value pairs of that specific section you asked for π
delete_section(section_name)
completely removes the specified section from the block. gone. poof. no takebacks π
add_to_section(section_name, $hash_ref)
adds the key/value pairs in that hash right into the specified section. like so:
$foo->add_to_section("_hostgroup", { "ns1.baz.com" -> "ok" });
delete_from_section(section_name, $key)
deletes that key/value pair from the section. bye bestie π
$foo->delete_from_section("_hostgroup", "ns1.baz.com");
error
so if any of these functions return an error, and that error is -1, you use this one to grab a more elaborate error message and to reset the internal error state. two jobs, one method, highkey efficient π§
fr fr, remember:-1means something went wrong, anderroris how you get the receipts and then wipe the slate clean.
that's the whole page bestie, you ate that π this one's from perl v5.32.0, dated 2021-01-04, and it's the Mon::Protocol(3pm) page β iykyk π
π¦ where this page comes from
- debian bookworm: mon-client 1.2.0-2.1 Β· GPL-2.0-or-later
- ubuntu jammy: mon-client 1.2.0-2.1 Β· GPL-2.0-or-later
- ubuntu noble: mon-client 1.2.0-2.1 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms