NAME
Mpp - Common subs for makepp and makeppreplay
DESCRIPTION
This package contains basic stuff for makepp.
Mpp::log
Mpp::log KEY => {object | array of objects | string} ...
if $log_level;
The list of available KEYs is present in makepplog. If you pass an non-key str if will later be output verbatim. The objects must have a method `name'.
This log overrides logarithm (which is not needed by makepp). Because of this, and because it is not exported, it must always be invoked as Mpp::log.
The log format contains a few control chars, denoted here as ^A, ^B ...
The first line is special, the invocation preceded by "logversion^A" as explained at @obsolete_msg in makepplog.
A leading ^B is stripped, but tells makepplog to outdent, and a leading ^C to indent. After that a line with no ^A is considered plain text. Else it is split on the ^A`s. There must be a ^A at the line end, which allows having multine fields between ^A`s. If the resulting fields contain ^B`s they are lists of simple fields, else just one simple field.
The first field is a message key. The others work as follows. If the simple fields contain ^C`s they are ref definitions of up to 4 fields:
ref[^Cname[^Cdir-ref[^Cdir-name]]]
The refs are hex numbers and the names are to be remembered by makepplog for these numbers. If a dir-name is present, that is remembered for dir-ref, else it has been given earlier. If a dir-ref is given, that is prepended to name with a slash and remembered for ref. Else if only name is given that is remembered for ref as is. If ref is alone, it has been given earlier. Makepplog will output the remembered name for refs between quotes.
The fields may also be plain strings if they contain no known ref. Due to the required terminator, the strings may contain newlines, which will get displayed as \n. For keys that start with N_, all fields are treated as plain numbers, even if they happen to coincide with a ref.
flush_log
Flush the log file and standard file handles. This is useful for making sure that output of a perl action is not lost before the action's process terminates with POSIX::_exit.