Another try at this markdown-thingy...

This commit is contained in:
2024-03-24 16:47:44 +01:00
parent 092ee984ee
commit 2f9024a47e

View File

@ -9,44 +9,40 @@ The modules must define a package following the same system; My::parser::package
The modules must define the following subs:
* new
### new
Arguments
* Arguments
1. class
2. config
1. class
2. config
Resulting self-> attributes
* Resulting self-> attributes:
* {'config'}
* {'parser'}
* {'config'} : Should be the contents of the argument "config"
* {'parser'} : The parser is commonly the output of the modules_parser->new()
The parser is commonly the output of the modules_parser->new()
* Returns $self
Returns $self
### parse
* parse
Takes no arguments
No arguments
Responsible to fetch whatever it wants to parse
Responsible to fetch whatever it wants to parse
Must return a dict:
Must return a dict:
* reval => 0 if nothing interesting, or
* retval => 1, retmsg => 'Any text you want the main module to know', lines => array of returns from the parser (See [module_parser](#module_parser))
* reval => 0 if nothing interesting, or
* retval => 1, retmsg => 'Any text you want the main module to know', lines => array of returns from the parser (See [module_parser](#module_parser))
### fetch
* fetch
A function that returns a line of text for the parser to parse from any source, via any method you desire. Should return 0 if there was no pending line.
A function that returns a line of text for the parser to parse from any source, via any method you desire. Should return 0 if there was no pending line.
## module_parser
A module responsible for parsing a line of text to a dictionary containing the following entries:
* retval: 1 for match, 0 if no match.
main program will print what your parser said about this from the key 'retmsg'
* retmsg: whatever text you think makes sense putting in the logs regarding the line you just parsed
* hostile: 0 if not, 1 if it is.
* host: IP4 representation of a host that did something. Only required if hostile is 1