SYNOPSIS

 require Log::Agent::Message;

 my $msg = Log::Agent::Message->make("string");
 $msg->prepend("string");
 $msg->append("string");
 my $copy = $msg->clone;

 print "Message is $msg\n";     # overloaded stringification

DESCRIPTION

The Log::Agent::Message class represents an original log message (a string) to which one may prepend or append other strings, but with the special property that prepended strings aggregate themselves in \s-1FIFO\s0 order, whilst appended strings aggregate themselves in \s-1LIFO\s0 order, which is counter-intuitive at first sight.

In plain words, this means that the last routine that prepends something to the message will get its prepended string right next to the original string, regardless of what could have been prepended already. The behaviour is symetric for appending.

INTERFACE

The following routines are available:

append($str)

Append suppled string $str to the original string (given at creation time), at the head of all existing appended strings.

append_last($str)

Append suppled string $str to the original string (given at creation time), at the tail of all existing appended strings.

clone

Clone the message. This is not a shallow clone, because the list of prepended and appended strings is recreated. However it is not a deep clone, because the items held in those lists are merely copied (this would matter only when other objects with overloaded stringification routines were supplied to prepend() and append(), which is not the case today in the basic Log::Agent framework).

make($string)

This is the creation routine.

prepend($str)

Prepend supplied string $str to the original string (given at creation time), at the tail of all existing prepended strings.

prepend_first($str)

Prepend supplied string $str to the original string (given at creation time), at the head of all existing prepended strings.

stringify

This is the overloaded "" operator, which returns the complete string composed of all the prepended strings, the original string, and all the appended strings.

AUTHOR

Raphael Manfredi <[email protected]>

RELATED TO Log::Agent::Message…

Log::Agent\|(3).