Log::Agent::Message - a log message
my $msg = Log::Agent::Message->make("string");
my $copy = $msg->clone;
print "Message is $msg\n"; # overloaded stringification
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 FIFO order, whilst appended strings aggregate themselves in LIFO 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.
The following routines are available:
Append suppled string $str to the original string (given at creation time), at the head of all existing appended strings.
Append suppled string $str to the original string (given at creation time), at the tail of all existing appended strings.
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).
This is the creation routine.
Prepend supplied string $str to the original string (given at creation time), at the tail of all existing prepended strings.
Prepend supplied string $str to the original string (given at creation time), at the head of all existing prepended strings.
This is the overloaded "" operator, which returns the complete string composed of all the prepended strings, the original string, and all the appended strings.
Raphael Manfredi <Raphael_Manfredi@pobox.com>
To install Log::Agent, copy and paste the appropriate command in to your terminal.
perl -MCPAN -e shell
For more information on module installation, please visit the detailed CPAN module installation guide.