ACC SHELL

Path : /usr/share/doc/packages/yast2-perl-bindings/
File Upload :
Current File : //usr/share/doc/packages/yast2-perl-bindings/YaPI.html

<?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>YaPI - common functions for modules implementing YaST API</title>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<link rev="made" href="mailto:feedback@suse.de" />
</head>

<body style="background-color: white">


<!-- INDEX BEGIN -->
<div name="index">
<p><a name="__index__"></a></p>

<ul>

	<li><a href="#name">NAME</a></li>
	<ul>

		<li><a href="#base_functions">base functions</a></li>
		<ul>

			<li><a href="#interface">Interface</a></li>
			<li><a href="#version">Version</a></li>
			<li><a href="#supports">Supports</a></li>
			<li><a href="#seterror">SetError</a></li>
			<li><a href="#error">Error</a></li>
		</ul>

		<li><a href="#i18n">i18n</a></li>
		<ul>

			<li><a href="#textdomain">textdomain</a></li>
			<li><a href="#____double_underscore_">__ (double underscore)</a></li>
		</ul>

	</ul>

</ul>

<hr name="index" />
</div>
<!-- INDEX END -->

<p>
</p>
<h1><a name="name">NAME</a></h1>
<p>YaPI - common functions for modules implementing YaST API</p>
<p>
</p>
<h2><a name="base_functions">base functions</a></h2>
<p>These are to be used by modules that use YaPI as their base class.</p>
<pre>
  use YaPI;
  our @ISA = (&quot;YaPI&quot;);</pre>
<p>
</p>
<h3><a name="interface">Interface</a></h3>
<p>Returns a reference to a list of hashes describing the functions
in the current package. The information is taken from TYPEINFO.</p>
<pre>
  [
   {
      functionName =&gt; &quot;contains&quot;,
      return =&gt; &quot;boolean&quot;,
      argument =&gt; [ &quot;string&quot;, [&quot;list&quot;, &quot;string&quot;]],
   },
   ...
  ]</pre>
<p>
</p>
<h3><a name="version">Version</a></h3>
<p>Returns the version of the current package.</p>
<p>
</p>
<h3><a name="supports">Supports</a></h3>
<p>Greps <code>@CAPABILITIES</code> of the current package.</p>
<pre>
  if (YaPI::Foo-&gt;Supports (&quot;frobnicate&quot;)) {...}</pre>
<p>
</p>
<h3><a name="seterror">SetError</a></h3>
<p>Logs an error and remembers it for <a href="#error">Error</a>.</p>
<p>Error map:</p>
<pre>
  {
    code                # mandatory, an uppercase short string
    summary
    description
  # if all of the following are missing, caller () is used
    package
    file
    line
  }</pre>
<p>
</p>
<h3><a name="error">Error</a></h3>
<p>Returns the error set by <a href="#seterror">SetError</a></p>
<p>
</p>
<h2><a name="i18n">i18n</a></h2>
<p><code>use YaPI;</code></p>
<p><code>textdomain &quot;mydomain&quot;;</code></p>
<p>Just use a double underscore to mark text to be translated: <code>__(&quot;my text&quot;)</code>.
Both <code>textdomain</code> and <code>__</code> are exported to the calling package.</p>
<p>These must not be used any longer because they collide with symbols
exported by this module:</p>
<pre>
 #  use Locale::gettext;    # textdomain
 #  sub _ { ... }</pre>
<p>These don't hurt but aren't necessary:</p>
<pre>
 #  use POSIX ();
 #  POSIX::setlocale(LC_MESSAGES, &quot;&quot;);    # YaPI calls it itself now</pre>
<p>
</p>
<h3><a name="textdomain">textdomain</a></h3>
<p>Calls Locale::gettext::textdomain
and also
remembers an association between the calling package and the
domain. Later calls of __ use this domain as an argument to dgettext.</p>
<p>
</p>
<h3><a name="____double_underscore_">__ (double underscore)</a></h3>
<p>Calls Locale::gettext::dgettext, supplying the textdomain of the calling
package (set by calling textdomain).</p>
<p>Note: the single underscore function (_) will be removed because it
is automaticaly exported to main:: which causes namespace conflicts.</p>

</body>

</html>

ACC SHELL 2018