Messaging::Message is a Perl module that provides an abstraction of a "message", as used in messaging, see for instance: http://en.wikipedia.org/wiki/Enterprise_messaging_system.
A message consists of header fields (collectively called "the header of the message") and a body.
Each header field is a key/value pair where the key and the value are text strings. The key is unique within the header so we can use a hash table to represent the header of the message.
The body is either a text string or a binary string. This distinction is needed because text may need to be encoded (for instance using UTF-8) before being stored on disk or sent across the network.
To make things clear:
- a text string (aka character string) is a sequence of Unicode characters
- a binary string (aka byte string) is a sequence of bytes
Both the header and the body can be empty.
SYNOPSIS
use Messaging::Message;
# constructor + setters
$msg = Messaging::Message->new();
$msg->body("hello world");
$msg->header({ subject => "test" });
$msg->header_field("message-id", 123);
# fancy constructor
$msg = Messaging::Message->new(
body => "hello world",
header => {
"subject" => "test",
"message-id" => 123,
},
);
# getters
if ($msg->body() =~ /something/) {
...
}
$id = $msg->header_field("message-id");
Product's homepage
Requirements:
· Perl