TakTuk(3pm)
π TakTuk β the Perl manual page, but make it make sense π
okay bestie, sit down, hydrate, and let me tell you about TakTuk, the Perl module that hands you an interface to the communication facilities of taktuk(1). yes. that taktuk(1). we're talking to the engine directly now. it's giving backstage pass energy. π
β¨ SYNOPSIS β¨
like, here's the whole vibe in code, no notes:
use TakTuk;
my $rank = TakTuk::get('rank');
my $count = TakTuk::get('count');
print "I'm process $rank among $count\n";
if ($rank > 1) {
my ($from, $message) = TakTuk::recv();
if (not defined($message)) {
print "Trying to recv: ",
TakTuk::error_msg($TakTuk::error), "\n";
} else {
print "$rank received $message from $from\n";
}
}
sleep 1;
my $next = $rank+1;
$next = 1 if ($next > $count);
if (not TakTuk::send(to=>$next, body=>"[Salut numero $rank]")) {
print "Trying to send to $next: ",
TakTuk::error_msg($TakTuk::error), "\n";
}
if ($rank == 1) {
my ($from, $message) = TakTuk::recv(timeout=>5);
if (not defined($message)) {
print "Trying to recv :",
TakTuk::error_msg($TakTuk::error), "\n";
} else {
print "$rank received $message from $from\n";
}
}
a little ring-around-the-rosie of processes passing messages. obsessed. π¦
πΈ DESCRIPTION πΈ
so the TakTuk communication layer Perl interface is how programs that got run by the taktuk(1) command get to talk to each other. π¬ It's built on a super simple send/receive model β multicast-like sends, and receives that can optionally have a timeout. lowkey elegant. BUT β and I need you to hear me on this β this is only meant to be a control facility. it is not a high performance communication library. do not come for her about throughput. she is not that girl and she never claimed to be. π
The Perl communication interface for TakTuk is made of functions that scripts can call. and those scripts get executed either:
- using the
taktuk_perlcommand of the TakTuk engine β this is the preferred way, because it means less installation requirements on the remote machines, slay β¨ - or using the TakTuk Perl module provided with the TakTuk distribution
and here are the functions, bestie:
TakTuk::get($)β gets some information from TakTuk. currently the available info is'target','rank','count','father','child_min'and'child_max'. and honestly? this is a better way to get this info than environment variables, because it takes into account renumbering that might occur after process spawn. no cap. πTakTuk::send(%)β sends a scalar to a single peer or to a set specification (go readtaktuk(1)for the tea on set specifications). the two mandatory fields in the arguments are"to"(with a set specification) and"body". optionally you can also pass a"target"field. returns an undefined value upon error. π«ΆTakTuk::recv(%)β blocks until a message shows up. returns a list of two elements: the logical number of the source of the message, and the message itself. it accepts an optional"timeout"argument with a numeric value. returns an empty list upon error. π
When an error occurs, all of these functions set the variable $TakTuk::error to the numeric code of the error that happened. and a textual description of the error is provided by the function TakTuk::error_msg($), which takes the error code as an argument. so you're never just staring at a number like ποΈπποΈ
π Error codes, aka the villain lineup π
TakTuk::ESWRITβ a call toTakTuk::syswritefailed. this is because of asyswriteerror different thanEAGAIN. the code should be accessible using$!.TakTuk::EFCLSDβ the communication channel to the TakTuk engine has been closed. this typically occurs when shutting down the logical network (like, using Ctrl-C on the root node for instance). rip. πͺ¦TakTuk::ESREAD(only forTakTuk::recv) β a call tosysreadfailed (the code should be accessible using$!).TakTuk::EARGTO(only forTakTuk::send) β the"to"field is missing in the arguments.TakTuk::EARGBD(only forTakTuk::send) β the"body"field is missing in the arguments.TakTuk::ETMOUT(only forTakTuk::recv) β the call toTakTuk::recvtimeouted. this only occurs when you gave a"timeout"field as aTakTuk::recvargument.
π The constants π
Finally β and this part is a whole mood β the TakTuk Perl module defines some constants whose values match the different states reported by the stream "state" (peep taktuk(1) for the details about this stream). these constants are:
TakTuk::TAKTUK_READY
TakTuk::TAKTUK_NUMBERED
TakTuk::TAKTUK_TERMINATED
TakTuk::CONNECTION_FAILED
TakTuk::CONNECTION_INITIALIZED
TakTuk::CONNECTION_LOST
TakTuk::COMMAND_STARTED
TakTuk::COMMAND_FAILED
TakTuk::COMMAND_TERMINATED
TakTuk::UPDATE_FAILED
TakTuk::PIPE_STARTED
TakTuk::PIPE_FAILED
TakTuk::PIPE_TERMINATED
TakTuk::FILE_RECEPTION_STARTED
TakTuk::FILE_RECEPTION_FAILED
TakTuk::FILE_RECEPTION_TERMINATED
TakTuk::FILE_SEND_FAILED
TakTuk::INVALID_TARGET
TakTuk::NO_TARGET
TakTuk::MESSAGE_DELIVERED
TakTuk::INVALID_DESTINATION
TakTuk::UNAVAILABLE_DESTINATION
π¦ SEE ALSO π¦
tatkuk(1), taktukcomm(3), TakTuk::Pilot(3)
yes, it says tatkuk(1) up there. that's what the page says, so that's what we're saying. iykyk. we don't edit the sacred text. π
π AUTHOR π
The original concept of TakTuk was proposed by Cyrille Martin in his PhD thesis. the people involved in this work include Jacques Briat, Olivier Richard, Thierry Gautier and Guillaume Huard. literal legends, all of them. π«Ά
The author of version 3 (the perl version) and the current maintainer of the package is Guillaume Huard.
π COPYRIGHT π
The "TakTuk" communication interface library is provided under the terms of the GNU General Public License version 2 or later. share and share alike, bestie. β¨
and that's the whole page, no crumbs left. this one came to you courtesy of perl v5.40.1, dated 2025-09-30. mwah. πππ¦
π¦ where this page comes from
- ubuntu resolute: libtaktuk-perl 3.7.8-1 Β· GPL-2.0-or-later
- ubuntu stonking: libtaktuk-perl 3.7.8-1 Β· 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