Sophie

Sophie

distrib > Mageia > 5 > i586 > media > core-release > by-pkgid > 04703c89a38a0988cb5f2736c0f9a688 > files > 14

perl-taktuk-3.7.5-3.mga5.i586.rpm

<?xml version="1.0" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>TakTuk</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:root@localhost" />
</head>

<body>



<ul id="index">
  <li><a href="#NAME">NAME</a></li>
  <li><a href="#SYNOPSIS">SYNOPSIS</a></li>
  <li><a href="#DESCRIPTION">DESCRIPTION</a></li>
  <li><a href="#SEE-ALSO">SEE ALSO</a></li>
  <li><a href="#AUTHOR">AUTHOR</a></li>
  <li><a href="#COPYRIGHT">COPYRIGHT</a></li>
</ul>



<center><h1>USER MANUAL</h1></center>

<h1 id="NAME">NAME</h1>

<p>TakTuk - Perl module that provides an interface to <code>taktuk(1)</code> communication facilities</p>

<h1 id="SYNOPSIS">SYNOPSIS</h1>

<pre><code>  use TakTuk;
  
  my $rank = TakTuk::get(&#39;rank&#39;);
  my $count = TakTuk::get(&#39;count&#39;);
  
  print &quot;I&#39;m process $rank among $count\n&quot;;
  
  if ($rank &gt; 1) {
      my ($from, $message) = TakTuk::recv();
      if (not defined($message)) {
          print &quot;Trying to recv: &quot;,
                TakTuk::error_msg($TakTuk::error), &quot;\n&quot;;
      } else {
          print &quot;$rank received $message from $from\n&quot;;
      }
  }
  
  sleep 1;
  my $next = $rank+1;
  $next = 1 if ($next &gt; $count);
  if (not TakTuk::send(to=&gt;$next, body=&gt;&quot;[Salut numero $rank]&quot;)) {
      print &quot;Trying to send to $next: &quot;,
            TakTuk::error_msg($TakTuk::error), &quot;\n&quot;;
  }
  
  if ($rank == 1) {
      my ($from, $message) = TakTuk::recv(timeout=&gt;5);
      if (not defined($message)) {
          print &quot;Trying to recv :&quot;,
                TakTuk::error_msg($TakTuk::error), &quot;\n&quot;;
      } else {
          print &quot;$rank received $message from $from\n&quot;;
      }
  }</code></pre>

<h1 id="DESCRIPTION">DESCRIPTION</h1>

<p>The <b>TakTuk</b> communication layer Perl interface provides a way for programs executed using the <code>taktuk(1)</code> 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.</p>

<p>The Perl communication interface for <b>TakTuk</b> is made of functions that can be called by scripts executed using the <code>taktuk_perl</code> command of the <b>TakTuk</b> engine (preferred way, less installation requirements on remote machines) or using the <b>TakTuk</b> Perl module provided with the <b>TakTuk</b> distribution. These functions are:</p>

<dl>

<dt id="TakTuk::get"><b>TakTuk::get($)</b></dt>
<dd>

<p>gets some information from <b>TakTuk</b>. Currently available information includes &#39;target&#39;, &#39;rank&#39;, &#39;count&#39;, &#39;father&#39;, &#39;child_min&#39; and &#39;child_max&#39;. This is a better way to get this information than environment variables as its takes into account renumbering that might occur after process spawn.</p>

</dd>
<dt id="TakTuk::send"><b>TakTuk::send(%)</b></dt>
<dd>

<p>sends a scalar to a single peer or a set specification (see <code>taktuk(1)</code> for information about set specifications). The two mandatory fields in the arguments are <code>to</code> (with a set specification) and <code>body</code>. Optionally, a field <code>target</code> might be given. Returns an undefined value upon error.</p>

</dd>
<dt id="TakTuk::recv"><b>TakTuk::recv(%)</b></dt>
<dd>

<p>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 <code>timeout</code> argument with a numeric value. Returns an empty list upon error.</p>

</dd>
</dl>

<p>When an error occur, all these functions set the variable <code>$TakTuk::error</code> to the numeric code of the error that occured. A textual description of the error is provided by the function <code>TakTuk::error_msg($)</code> that takes the error code as an argument.</p>

<p>Error codes are the following :</p>

<dl>

<dt id="TakTuk::ESWRIT">TakTuk::ESWRIT</dt>
<dd>

<p>a call to <code>TakTuk::syswrite</code> failed. This is due to a <code>syswrite</code> error different than <code>EAGAIN</code>. The code should be accessible using <code>$!</code>.</p>

</dd>
<dt id="TakTuk::EFCLSD">TakTuk::EFCLSD</dt>
<dd>

<p>the communication channel to the <b>TakTuk</b> engine has been closed. This typically occur when shutting down the logical network (using Ctrl-C on root node for instance).</p>

</dd>
<dt id="TakTuk::ESREAD-TakTuk::recv-only">TakTuk::ESREAD (<code>TakTuk::recv</code> only)</dt>
<dd>

<p>a call to <code>sysread</code> failed (the code should be accessible using <code>$!</code>).</p>

</dd>
<dt id="TakTuk::EARGTO-TakTuk::send-only">TakTuk::EARGTO (<code>TakTuk::send</code> only)</dt>
<dd>

<p><code>to</code> field missing in the arguments.</p>

</dd>
<dt id="TakTuk::EARGBD-TakTuk::send-only">TakTuk::EARGBD (<code>TakTuk::send</code> only)</dt>
<dd>

<p><code>body</code> field missing in the arguments.</p>

</dd>
<dt id="TakTuk::ETMOUT-TakTuk::recv-only">TakTuk::ETMOUT (<code>TakTuk::recv</code> only)</dt>
<dd>

<p>The call to <code>TakTuk::recv</code> timeouted. This only occur when giving a <code>timeout</code> field as <code>TakTuk::recv</code> argument.</p>

</dd>
</dl>

<p>Finally, the <b>TakTuk</b> Perl module defines some constants which value match the different states reported by the stream <code>state</code> (see <code>taktuk(1)</code> for details about this stream). These constant are the following:</p>

<pre><code>  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</code></pre>

<h1 id="SEE-ALSO">SEE ALSO</h1>

<p><code>tatkuk(1)</code>, <code>taktukcomm(3)</code>, <code>TakTuk::Pilot(3)</code></p>

<h1 id="AUTHOR">AUTHOR</h1>

<p>The original concept of <b>TakTuk</b> 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.</p>

<p>The author of the version 3 (perl version) and current maintainer of the package is Guillaume Huard.</p>

<h1 id="COPYRIGHT">COPYRIGHT</h1>

<p>The <code>TakTuk</code> communication interface library is provided under the terms of the GNU General Public License version 2 or later.</p>


</body>

</html>