Libgenders(3)
π Libgenders(3) β Perl extension for libgenders π
User Contributed Perl Documentation, but make it group chat: this is the Perl extension for libgenders, and bestie, we are going to cover literally every function, return value, and error constant together. π«Ά
πΈ NAME πΈ
Libgenders - Perl extension for libgenders.
β¨ SYNOPSIS β¨
Okay so hereβs the whole vibe in code form β copy it exactly, no cap:
use Libgenders;
Libgenders::GENDERS_ERR_SUCCESS
Libgenders::GENDERS_ERR_NULLHANDLE
Libgenders::GENDERS_ERR_OPEN
Libgenders::GENDERS_ERR_READ
Libgenders::GENDERS_ERR_PARSE
Libgenders::GENDERS_ERR_NOTLOADED
Libgenders::GENDERS_ERR_ISLOADED
Libgenders::GENDERS_ERR_OVERFLOW
Libgenders::GENDERS_ERR_PARAMETERS
Libgenders::GENDERS_ERR_NULLPTR
Libgenders::GENDERS_ERR_NOTFOUND
Libgenders::GENDERS_ERR_SYNTAX
Libgenders::GENDERS_ERR_QUERYINPUT
Libgenders::GENDERS_ERR_OUTMEM
Libgenders::GENDERS_ERR_MAGIC
Libgenders::GENDERS_ERR_INTERNAL
Libgenders::GENDERS_ERR_ERRNUMRANGE
Libgenders::GENDERS_DEFAULT_FILE
$handle = Libgenders->genders_handle_create();
$handle->genders_load_data([$filename]);
$handle->genders_errnum()
$handle->genders_strerror($errnum)
$handle->genders_errormsg()
$handle->genders_perror($msg)
$handle->genders_getnumnodes()
$handle->genders_getnumattrs()
$handle->genders_getnodename()
$handle->genders_getnodes([$attr, [$val]])
$handle->genders_getattr([$node])
$handle->genders_getattr_all()
$handle->genders_getattrval($attr, [$node])
$handle->genders_testattr($attr, [$node])
$handle->genders_testattrval($attr, $val, [$node])
$handle->genders_isnode([$node])
$handle->genders_isattr($attr)
$handle->genders_isattrval($attr, $val)
$handle->genders_index_attrvals($attr)
$handle->genders_query([$query])
$handle->genders_testquery($query, [$node])
$handle->genders_parse([$filename]);
π¦ DESCRIPTION π¦
Okay so this package provides a Perl interface to the genders C API (see libgenders(3)). The Perl interface is similar to the genders C API, with some necessary changes due to the inherent differences between C and Perl. Fr fr: some of the functions from the C API cannot be accessed via this Perl interface, some new functions were created, the behavior of some functions was modified, and the parameters passed into some functions have been changed. Please read the instructions below so you understand how to use the Libgenders package.
π Initialization π
Libgenders->genders_handle_createβ Returns a genders object on success,undefon error. π$handle->genders_load_data([$filename])β Opens, reads, and parses the genders file specified by$filename. If$filenameis not specified, the default genders file is parsed. Returns0on success,-1on error.
π Error Messages π
Similarly to the C API, an error code is stored in the genders object after an error has occurred. The following can be used to retrieve the error code and output information about the error.
$handle->genders_errnum()β Returns the error code most recently set.$handle->genders_strerror($errnum)β Returns a string describing the error code$errnum.$handle->genders_errormsg()β Returns a string describing the most recent error.$handle->genders_perror([$msg])β Outputs$msgand a string describing the most recent error to standard error. If$msgis not specified, only a description of the most recent error will be output to standard error.
π οΈ Utility Functions π οΈ
$handle->genders_getnumnodes()β Returns the number of nodes listed in the genders file. Returns-1on error.$handle->genders_getnumattrs()β Returns the number of attributes listed in the genders file. Returns-1on error.$handle->genders_getnodename()β Returns the shortened hostname of the current node. Returnsundefon error.
π Parsing Functions π
This is the main character section, fr fr. π
$handle->genders_getnodes([$attr, [$val]])β Returns a reference to a list of nodes that have the specified attribute and value. If$valis not specified, only$attris considered. If both$attrand$valare not specified, all nodes listed in the genders file are returned. Returnsundefon error.$handle->genders_getattr([$node])β Returns a reference to an array that holds references to two lists. The first list is a reference to an array of attributes for the specified node. The second list is a reference to an array of values for the specified node. If$nodeis not specified, the local node is used. Returnsundefon error.$handle->genders_getattr_all()β Returns a reference to a list of all the attributes listed in the genders file. Returnsundefon error.$handle->genders_getattrval($attr, [$node])β Returns the value of an attribute listed in a node. Returns the empty string if the attribute has no value. If$nodeis not specified, the local node is used. Returnsundefon error.$handle->genders_testattr($attr, [$node])β Tests if a node has a specified attribute. If$nodeis not specified, the local node is used. Returns1if the node contains the attribute,0if not,-1on error.$handle->genders_testattrval($attr, $val, [$node])β Tests if a node has a specified attribute=value pair. If$nodeis not specified, the local node is used. Returns1if the node contains the attribute=value pair,0if not,-1on error.$handle->genders_isnode([$node])β Tests if a node is listed in the genders file. If$nodeis not specified, the local node is used. Returns1if the node is listed,0if it is not,-1on error.$handle->genders_isattr($attr)β Tests if the attribute$attris listed in the genders file. Returns1if the attribute is listed,0if it is not,-1on error.$handle->genders_isattrval($attr, $val)β Tests if the attribute=value pair is listed in the genders file. Returns1if the pair is listed,0if it is not,-1on error.$handle->genders_index_attrvals($attr)β Internally adds indexing to decrease search times for genders attribute value combinations. Will specifically aid performance of thegenders_getnodesandgenders_isattrvalfunctions. Only one attribute can be indexed at a time. Subsequent calls to this function with a different attribute will overwrite earlier indexes.$handle->genders_query([$query])β Returns a reference to a list of nodes specified by a genders query. A genders query is based on the union, intersection, set difference, or complement between genders attributes and values. Union is represented by two pipe symbols (||), intersection by two ampersand symbols (&&), difference by two minus symbols (--), and complement by a tilde (~). Operations are performed from left to right. Parentheses may be used to change the order of operations. For example, the following query would retrieve all nodes other than management or login nodes:~(mgmt||login). If$queryis not specified, all nodes listed in the genders file are returned. Returnsundefon error.$handle->genders_testquery($query, [$node])β Tests if a node meets the conditions specified in the query. If$nodeis not specified, the local node is used. Returns1if the node is contained within the query,0if not,-1on error.$handle->genders_parse([$filename])β Parse a genders file and output parse errors to standard error. If$filenameis not specified, the default genders file is parsed. Returns the number of errors (0if no parse errors were found) on success,-1on error.
π§ Error Codes/Constants π§
The same error codes and constants listed in /usr/include/genders.h can be accessed through the following functions:
Libgenders::GENDERS_ERR_SUCCESS
Libgenders::GENDERS_ERR_NULLHANDLE
Libgenders::GENDERS_ERR_OPEN
Libgenders::GENDERS_ERR_READ
Libgenders::GENDERS_ERR_PARSE
Libgenders::GENDERS_ERR_NOTLOADED
Libgenders::GENDERS_ERR_ISLOADED
Libgenders::GENDERS_ERR_OVERFLOW
Libgenders::GENDERS_ERR_PARAMETERS
Libgenders::GENDERS_ERR_NULLPTR
Libgenders::GENDERS_ERR_NOTFOUND
Libgenders::GENDERS_ERR_OUTMEM
Libgenders::GENDERS_ERR_SYNTAX
Libgenders::GENDERS_ERR_QUERYINPUT
Libgenders::GENDERS_ERR_MAGIC
Libgenders::GENDERS_ERR_INTERNAL
Libgenders::GENDERS_ERR_ERRNUMRANGE
Libgenders::GENDERS_DEFAULT_FILE
π AUTHOR π
Iconic author energy: Albert Chu <chu11@llnl.gov>.
π SEE ALSO π
libgenders
π Sign-off: perl v5.40.2, dated 2025-07-23, for Libgenders(3) β stay hydrated and may your parse errors be zero. π
π¦ where this page comes from
- epel 10: genders-perl 1.28.1~^20231119git27b915d-5.el10_2 Β· GPL-2.0-only
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms