Agent::Message(3pm)

πŸ“¦
version 1.005 Β· 5 versions
, in ubuntu noble, ubuntu resolute, ubuntu stonking

✨ 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 $str to 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 $str to 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 to prepend() and append() β€” 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 $str to 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 $str to 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 🌸

Log::Agent(3).


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