DOKK / manpages / debian 12 / tirex / Tirex::Message.3pm.en
Tirex::Message(3pm) User Contributed Perl Documentation Tirex::Message(3pm)

Tirex::Message - A message

my $msg = Tirex::Message->new( ... );

Messages are used to exchange requests and replies between different components of the Tirex system.

"On the wire" they consist of several lines (separated by an optional carriage return and a newline). Each line has the form "key=value". No spaces are allowed before or after the key or equals sign.

Tirex::Message->new( type => '...', field1key => "field2value", ... )

Create new message. You always need a type for the message, all other fields are optional.

Will croak if there is no type given.

Create message object from string.

Read a datagram from given socket and create new message from it.

$msg->reply([RESULT[, ERRMSG]])

Create new message with reply to old one. If RESULT is not given it defaults to 'ok'. If ERRMSG is given, it is attached to the message.

You can't send a reply to a reply, so if the original message contains a 'result' field, this method croaks.

Serialize this message into a string with lines of the format key=value.

If a value is undefined the field is not added.

Return string version of this message, for instance for debugging. Format is key=value separated by spaces.

If a value is undefined the field is not added.

$msg->send($socket, $dest)

Send message through $socket to $dest.

Create metatile from message.

Croaks when the message can't be made into a valid metatile.

Is this message a positive reply (contains 'result=ok')?

Is this an error message for an unknown message type (contains 'result=error_unknown_command')?

2023-04-11 perl v5.36.0