Tirex::Message(3pm)
πΈ Tirex::Message π
ok so bestie, welcome to Tirex::Message β part of the User Contributed Perl Documentation, and lowkey the little messenger fairy of the whole Tirex system. it's a message. that's it. that's the vibe. β¨
β¨ NAME β¨
Tirex::Message β A message π«Ά
π SYNOPSIS π
my $msg = Tirex::Message->new( ... );
that's it bestie, that's the whole doorway. come on in π
π¦ DESCRIPTION π¦
okay so here's the tea: messages are how all the different Tirex components talk to each other β requests go one way, replies come back the other. it's giving group chat but for daemons. π¬
"On the wire" (so literally when they're travelling down the socket, no cap), they're made up of several lines, and those lines are separated by an optional carriage return plus a newline. every single line looks like key=value. and listen β no spaces allowed before or after the key or the equals sign. not one. zero. nada. π
βοΈ
π METHODS π
Tirex::Message->new( type => '...', field1key => "field2value", ... )
make a brand new message, slay. you always need a type for the message β all the other fields are optional, so no pressure on those. β¨
β οΈ will croak if there's no type given. so likeβ¦ give it a type, bestie. π
Tirex::Message->new_from_string("type=foo\nbar=baz\n")
build a message object straight from a string. string in, message out, iconic. πͺ
Tirex::Message->new_from_socket($socket)
read a datagram from the given $socket and make a new message out of it. socket goes in, message comes out. π
$msg->reply([RESULT[, ERRMSG]])
make a new message that's the reply to the old one. if you don't pass RESULT, it just defaults to 'ok'. and if you do pass ERRMSG, it gets attached to the message. π
π« you can't send a reply to a reply, so if the original message already contains a 'result' field, this method croaks. no infinite reply loops in this house. periodt.
$msg->serialize()
serialize this message into a string with lines in the format key=value. π
if a value is undefined, that field justβ¦ doesn't get added. we don't talk about it. π
$msg->to_s()
returns the string version of this message β super handy for debugging. format is key=value with the pairs separated by spaces. π
if a value is undefined, that field isn't added here either. β¨
$msg->send($socket, $dest)
send the message through $socket to $dest. go, baby, go π¦
$msg->to_metatile()
create a metatile from the message. β¨
β οΈ croaks when the message can't be made into a valid metatile. it's not mad, it's just disappointed.
$msg->ok()
is this message a positive reply? it checks for 'result=ok'. π
$msg->unknown_message_type()
is this an error message for an unknown message type? it checks for 'result=error_unknown_command'. π€
and that's the whole page bestie, we ate and left no crumbs π
mwah π β this was written by the tirex perl people, and it's perl v5.40.1, dated 2026-08-09. go forth and key=value responsibly. bye bestie!! π
π¦ where this page comes from
- ubuntu stonking: tirex 0.8.0+ds-2build3 Β· GPL-2.0-or-later
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms