Agent::Message(3pm)
β¨ NAME β¨
Log::Agent::Message β it's a log message, bestie. That's it, that's the whole thing. π
(And hi, this page is Agent::Message(3pm) from the User Contributed Perl Documentation, so now you know where you are π
)
π 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 π¦
Okay so the Log::Agent::Message class is literally an original log message (a string, bestie, just a string) that you can slap more strings onto β before it or after it. And here's where it gets iconic and also a tiny bit unhinged: the strings you prepend gather themselves in FIFO order, while the strings you append gather themselves in LIFO order. Which, yeah, is counter-intuitive at first sight. Not me warning you in advance. π
In plain words (because we're translating): the last routine that prepends something to the message gets its prepended string sitting right next to the original string, no matter what was already prepended before it. The behaviour is perfectly symmetric for appending. Periodt. β¨
π INTERFACE π
The following routines are available, bestie β collect them all:
append($str)β appends the supplied string$strto the original string (the one you gave at creation time), right at the head of all the existing appended strings.append_last($str)β appends the supplied string$strto the original string (again, the one from creation time), but this time at the tail of all the existing appended strings.cloneβ clones the message. Heads up: this is not a shallow clone, because the list of prepended and appended strings gets recreated. But it's also not a deep clone, because the items held in those lists are merely copied. (That distinction would only matter if you'd passed in other objects with overloaded stringification routines toprepend()andappend()β which today, in the basic Log::Agent framework, is just not the case. So don't stress. π«Ά)make($string)β this is the creation routine, the main character, the origin story. πprepend($str)β prepends the supplied string$strto the original string (yes, the one given at creation time), at the tail of all the existing prepended strings.prepend_first($str)β prepends the supplied string$strto the original string (creation time, you know the drill), at the head of all the existing prepended strings.stringifyβ this is the overloaded""operator, and it returns the complete string: all the prepended strings, then the original string, then all the appended strings. The whole glow-up in one go. π
π AUTHOR π
Raphael Manfredi <Raphael_Manfredi@pobox.com> β thank you for your service, king. π«‘
πΈ SEE ALSO πΈ
okay that's the whole page, you're welcome π this was perl v5.36.0, dated 2022-10-15, and it lives under Agent::Message(3pm) β bye bestie, go forth and stringify π¦πβ¨
π¦ where this page comes from
- ubuntu noble: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu resolute: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- ubuntu stonking: liblog-agent-perl 1.005-2 Β· Artistic-2.0
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms