TakTuk(3)
π NAME π
TakTuk β a Perl module that gives you an interface to the communication facilities of taktuk(1). This page is from the User Contributed Perl Documentation, and yes bestie, we're gonna get through it together π
β¨
π SYNOPSIS π
Here's the code vibe, fr fr:
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";
}
}
π¦ DESCRIPTION π¦
The TakTuk communication layer Perl interface gives programs that are executed using the taktuk(1) command a way to exchange data. It's built on a simple send/receive model: multicast-like sends, and receives that can optionally have a timeout. This is only designed to be a control facility β in particular, it is not a high-performance communication library. No cap π
The Perl communication interface for TakTuk is made of functions that scripts can call. Those scripts are executed using the taktuk_perl command of the TakTuk engine (that's the preferred way β less installation requirements on remote machines) or using the TakTuk Perl module provided with the TakTuk distribution. These functions are:
β¨ The functions β¨
TakTuk::get($)
Gets some information from TakTuk. The information currently available includes 'target', 'rank', 'count', 'father', 'child_min' and 'child_max'. This is a better way to get this information than environment variables, because it takes into account renumbering that might occur after process spawn. Iconic β¨
TakTuk::send(%)
Sends a scalar to a single peer or a set specification (see taktuk(1) for information about set specifications). The two mandatory fields in the arguments are "to" (with a set specification) and "body". Optionally, a field "target" might be given. Returns an undefined value upon error. π
TakTuk::recv(%)
Blocks until the reception of a message. Returns a list of two elements: the logical number of the source of the message and the message itself. Accepts an optional "timeout" argument with a numeric value. Returns an empty list upon error. π«Ά
When an error occurs, all these functions set the variable $TakTuk::error to the numeric code of the error that occurred. A textual description of the error is provided by the function TakTuk::error_msg($), which takes the error code as an argument. Good to know, bestie π
π¨ Error codes, bestie π¨
Error codes are the following :
TakTuk::ESWRITβ a call toTakTuk::syswritefailed. This is due to 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 (using Ctrl+C on the root node for instance).TakTuk::ESREAD(TakTuk::recvonly) β a call tosysreadfailed (the code should be accessible using$!).TakTuk::EARGTO(TakTuk::sendonly) β"to"field missing in the arguments.TakTuk::EARGBD(TakTuk::sendonly) β"body"field missing in the arguments.TakTuk::ETMOUT(TakTuk::recvonly) β the call toTakTuk::recvtimeouted. This only occurs when giving a"timeout"field asTakTuk::recvargument.
Finally, the TakTuk Perl module defines some constants whose values match the different states reported by the stream state (see taktuk(1) for details about this stream). These constants are the following:
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) β go read those too, bestie π
π AUTHOR π
The original concept of TakTuk has been proposed by Cyrille Martin in his PhD thesis. People involved in this work include Jacques Briat, Olivier Richard, Thierry Gautier and Guillaume Huard.
The author of the version 3 (perl version) and current maintainer of the package is Guillaume Huard. Main character energy, honestly π
π COPYRIGHT π
The TakTuk communication interface library is provided under the terms of the GNU General Public License version 2 or later. π
π And that's the page! Cute sign-off: TakTuk(3) Β· perl v5.42.3 Β· 1980-01-01 β bye bestie, go exchange some data! π
π¦ where this page comes from
- nixos 26.05: taktuk 3.7.7
- nixpkgs unstable: taktuk 3.7.8
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms