1Agent::Message(3) User Contributed Perl Documentation Agent::Message(3)
2
3
4
6 Log::Agent::Message - a log message
7
9 require Log::Agent::Message;
10
11 my $msg = Log::Agent::Message->make("string");
12 $msg->prepend("string");
13 $msg->append("string");
14 my $copy = $msg->clone;
15
16 print "Message is $msg\n"; # overloaded stringification
17
19 The Log::Agent::Message class represents an original log message (a
20 string) to which one may prepend or append other strings, but with the
21 special property that prepended strings aggregate themselves in FIFO
22 order, whilst appended strings aggregate themselves in LIFO order,
23 which is counter-intuitive at first sight.
24
25 In plain words, this means that the last routine that prepends
26 something to the message will get its prepended string right next to
27 the original string, regardless of what could have been prepended
28 already. The behaviour is symetric for appending.
29
31 The following routines are available:
32
33 append($str)
34 Append suppled string $str to the original string (given at
35 creation time), at the head of all existing appended strings.
36
37 append_last($str)
38 Append suppled string $str to the original string (given at
39 creation time), at the tail of all existing appended strings.
40
41 clone
42 Clone the message. This is not a shallow clone, because the list of
43 prepended and appended strings is recreated. However it is not a
44 deep clone, because the items held in those lists are merely copied
45 (this would matter only when other objects with overloaded
46 stringification routines were supplied to prepend() and append(),
47 which is not the case today in the basic Log::Agent framework).
48
49 make($string)
50 This is the creation routine.
51
52 prepend($str)
53 Prepend supplied string $str to the original string (given at
54 creation time), at the tail of all existing prepended strings.
55
56 prepend_first($str)
57 Prepend supplied string $str to the original string (given at
58 creation time), at the head of all existing prepended strings.
59
60 stringify
61 This is the overloaded "" operator, which returns the complete
62 string composed of all the prepended strings, the original string,
63 and all the appended strings.
64
66 Raphael Manfredi <Raphael_Manfredi@pobox.com>
67
69 Log::Agent(3).
70
71
72
73perl v5.34.0 2021-07-22 Agent::Message(3)