Genders(3)

πŸ“¦
version 1.27-3 Β· 4 versions
, in debian trixie, ubuntu questing, ubuntu resolute, ubuntu stonking

✨ Genders β€” bestie edition ✨

okay so this is the Genders perl library, and it's literally a perl interface for querying a genders file. that's it, that's the vibe. it's a User Contributed Perl Documentation page, section 3 of the manual, and honestly? she ate. πŸ’…


πŸŽ€ SYNOPSIS πŸŽ€

here's the whole menu of what you can call, no cap:

use Genders;

$Genders::GENDERS_DEFAULT_FILE;

$obj = Genders->new([$filename])

$obj->debug($num)

$obj->getnodename()
$obj->getnodes([$attr, [$val]])
$obj->getattr([$node])
$obj->getattr_all()
$obj->getattrval($attr, [$node])

$obj->testattr($attr, [$node])
$obj->testattrval($attr, $val, [$node])

$obj->isnode([$node])
$obj->isattr($attr)
$obj->isattrval($attr, $val)

$obj->index_attrvals($attr)

$obj->query($query)
$obj->testquery($query, [$node])

πŸ¦‹ DESCRIPTION πŸ¦‹

so this package gives you a perl interface for querying a genders file. periodt. let's go through every single method one by one because we are not skipping anything in this house πŸ’–

  • Genders->new([$filename]) β€” makes a Genders object and loads genders data from the file you named. if you don't specify a genders file, the default genders file gets used instead. and heads up: it returns undef if the file can't be read. 😭
  • $obj->debug($num) β€” sets the debug level on the genders object. default is 0 and that means all debugging is off. wanna turn it on? set the level to 1. simple as.
  • $obj->getnodename() β€” returns the name of the current node. main character identification, honestly πŸ‘‘
  • $obj->getnodes([$attr, [$val]]) β€” returns a list of nodes that have the attribute and value you specified. if you don't give a value, only the attribute is considered. if you don't give an attribute at all, you get all the nodes listed in the genders file. generous queen.
  • $obj->getattr([$node]) β€” returns a list of attributes for the node you specified. if you don't specify a node, the local node's attributes get returned instead.
  • $obj->getattr_all() β€” returns a list of all attributes listed in the genders file. the full collection, no filter ✨
  • $obj->getattrval($attr, [$node]) β€” returns the value of the specified attribute for the specified node. if the attribute doesn't exist, or the attribute has no value, you get an empty string back. and if you don't specify the node, the local node's attribute value is returned.
  • $obj->testattr($attr, [$node]) β€” returns 1 if the specified node has the specified attribute, 0 if it doesn't. if you don't specify a node, the local node gets checked.
  • $obj->testattrval($attr, $val, [$node]) β€” returns 1 if the specified node has the specified attribute and value, 0 if it doesn't. no node specified? local node gets checked.
  • $obj->isnode([$node]) β€” returns 1 if the specified node is listed in the genders file, 0 if it's not. no node specified? you already know β€” local node gets checked.
  • $obj->isattr($attr) β€” returns 1 if the specified attribute is listed in the genders file, 0 if it's not.
  • $obj->isattrval($attr, $val) β€” returns 1 if the specified attribute is equal to the specified value for some node in the genders file, 0 if it's not.
  • $obj->index_attrvals($attr) β€” internally indexes genders attribute values so searches go faster. lowkey a glow-up for your query speed. just know that subsequent calls with a different attribute will overwrite earlier indexes, so don't come crying when your old index is gone πŸ™ˆ
  • $obj->query($query) β€” returns 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. here's the cheat sheet:
    • union = two pipe symbols ('||')
    • intersection = two ampersand symbols ('&&')
    • difference = two minus symbols ('--')
    • complement = a tilde ('~')

operations are performed from left to right. parentheses may be used to change the order of operations. for example, this query would retrieve all nodes other than management or login nodes: "~(mgmt||login)". and if the query isn't specified, all nodes listed in the genders file are returned. iconic default behaviour fr fr.

  • $obj->testquery($query, [$node]) β€” returns 1 if the specified node meets the conditions of the specified query, 0 if it doesn't. no node specified? yeah babe, local node gets checked.

πŸ‘‘ AUTHOR πŸ‘‘

Albert Chu <chu11@llnl.gov> β€” we stan a legend 🫢


🌈 SEE ALSO 🌈

  • Libgenders.
  • libgenders.

πŸ’€ quick reminder bestie: all the file reading, undef returns, overwritten indexes and left-to-right query evaluation are real and they will humble you if you ignore them. the vibe is cute, the semantics are not negotiable.

and that's the page, babes πŸ’œ this was perl v5.10.1, dated 2013-08-02, Genders(3) β€” mwah, slay, periodt. go query something 🌸

πŸ“¦ where this page comes from