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