1Genders(3) User Contributed Perl Documentation Genders(3)
2
3
4
6 Genders - Perl library for querying a genders file
7
9 use Genders;
10
11 $Genders::GENDERS_DEFAULT_FILE;
12
13 $obj = Genders->new([$filename])
14
15 $obj->debug($num)
16
17 $obj->getnodename()
18 $obj->getnodes([$attr, [$val]])
19 $obj->getattr([$node])
20 $obj->getattr_all()
21 $obj->getattrval($attr, [$node])
22
23 $obj->testattr($attr, [$node])
24 $obj->testattrval($attr, $val, [$node])
25
26 $obj->isnode([$node])
27 $obj->isattr($attr)
28 $obj->isattrval($attr, $val)
29
30 $obj->index_attrvals($attr)
31
32 $obj->query($query)
33 $obj->testquery($query, [$node])
34
36 This package provides a perl interface for querying a genders file.
37
38 Genders->new([$filename])
39 Creates a Genders object and load genders data from the specified
40 file. If the genders file is not specified, the default genders
41 file will be used. Returns undef if file cannot be read.
42
43 $obj->debug($num)
44 Set the debug level in the genders object. By default, the debug
45 level is 0 and all debugging is turned off. To turn it on, set the
46 level to 1.
47
48 $obj->getnodename()
49 Returns the name of the current node.
50
51 $obj->getnodes([$attr, [$val]])
52 Returns a list of nodes with the specified attribute and value. If
53 a value is not specified only the attribute is considered. If the
54 attribute is not specified, all nodes listed in the genders file
55 are returned.
56
57 $obj->getattr([$node])
58 Returns a list of attributes for the specified node. If the node
59 is not specified, the local node's attributes returned.
60
61 $obj->getattr_all()
62 Returns a list of all attributes listed in the genders file.
63
64 $obj->getattrval($attr, [$node])
65 Returns the value of the specified attribute for the specified
66 node. If the attribute does not exist or the attribute has no
67 value, an empty string is returned. If the node is not specified,
68 the local node's attribute value is returned.
69
70 $obj->testattr($attr, [$node])
71 Returns 1 if the specified node has the specified attribute, 0 if
72 it does not. If the node is not specified, the local node is
73 checked.
74
75 $obj->testattrval($attr, $val, [$node])
76 Returns 1 if the specified node has the specified attribute and
77 value, 0 if it does not. If the node is not specified, the local
78 node is checked.
79
80 $obj->isnode([$node])
81 Returns 1 if the specified node is listed in the genders file, 0 if
82 it is not. If the node is not specified, the local node is
83 checked.
84
85 $obj->isattr($attr)
86 Returns 1 if the specified attribute is listed in the genders file,
87 0 if it is not.
88
89 $obj->isattrval($attr, $val)
90 Returns 1 if the specified attribute is equal to the specified
91 value for some node in the genders file, 0 if it is not.
92
93 $obj->index_attrvals($attr)
94 Internally indexes genders attribute values for faster search
95 times. Subsequent calls with a different attribute will overwrite
96 earlier indexes.
97
98 $obj->query($query)
99 Returns a list of nodes specified by a genders query. A genders
100 query is based on the union, intersection, set difference, or
101 complement between genders attributes and values. Union is
102 represented by two pipe symbols ('||'), intersection by two
103 ampersand symbols ('&&'), difference by two minus symbols ('--'),
104 and complement by a tilde ('~') Operations are performed from left
105 to right. Parentheses may be used to change the order of
106 operations. For example, the following query would retrieve all
107 nodes other than management or login nodes: "~(mgmt||login)". If
108 the query is not specified, all nodes listed in the genders file
109 are returned.
110
111 $obj->testquery($query, [$node])
112 Returns 1 if the specified node meets the conditions of the
113 specified query, 0 if it does not. If the node is not specified,
114 the local node is checked.
115
117 Albert Chu <chu11@llnl.gov>
118
120 Libgenders.
121
122 libgenders.
123
124
125
126perl v5.10.1 2013-08-02 Genders(3)