TakTuk(3pm) | User Contributed Perl Documentation | TakTuk(3pm) |
TakTuk - Perl module that provides an interface to "taktuk(1)" communication facilities
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"; } }
The TakTuk communication layer Perl interface provides a way for programs executed using the taktuk(1) command to exchange data. It is based on a simple send/receive model using multicast-like sends and optionally timeouted receives. This is only designed to be a control facility, in particular this is not a high performance communication library.
The Perl communication interface for TakTuk is made of functions that can be called by scripts executed using the "taktuk_perl" command of the TakTuk engine (preferred way, less installation requirements on remote machines) or using the TakTuk Perl module provided with the TakTuk distribution. These functions are:
When an error occur, 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($) that takes the error code as an argument.
Error codes are the following :
Finally, the TakTuk Perl module defines some constants which value match the different states reported by the stream "state" (see taktuk(1) for details about this stream). These constant 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
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.
The "TakTuk" communication interface library is provided under the terms of the GNU General Public License version 2 or later.
2022-07-28 | perl v5.34.0 |