1Exacct::Object(3PERL) Perl Library Functions Exacct::Object(3PERL)
2
3
4
6 Exacct::Object - exacct object manipulation
7
9 use Sun::Solaris::Exacct::Object qw(:ALL);
10 print($ea_obj->value(), "\n");
11
12
14 This module is used as a parent of the two possible types of Perl
15 exacct objects: Items and Groups. An Item is either a single data value
16 such as the number of seconds of user CPU time consumed by a process,
17 an embedded Perl exacct object, or a block of raw data. A Group is an
18 ordered collection of Perl exacct Items such as all of the resource
19 usage values for a particular process or task. If Groups need to be
20 nested within each other, the inner Groups can be stored as embedded
21 Perl exacct objects inside the enclosing Group.
22
23
24 This module contains methods that are common to both Perl exacct Items
25 and Groups. The attributes of Sun::Solaris::Exacct::Object and all
26 classes derived from it are read-only after initial creation with
27 new(). This behavior prevents the inadvertent modification of the
28 attributes that could produce inconsistent catalog tags and data val‐
29 ues. The only exception is the array used to store the Items inside a
30 Group object, which can be modified using the normal Perl array opera‐
31 tors. See the value() method below.
32
33 Constants
34 EO_ERROR, EO_NONE, EO_ITEM, and EO_GROUP.
35
36 Functions
37 None.
38
39 Class methods
40 dump($object, $filehandle) This method dumps formatted text repre‐
41 sentation of a Perl exacct object to the
42 supplied file handle. If no file handle
43 is specified, the text representation is
44 dumped to STDOUT. See EXAMPLES below for
45 sample output.
46
47
48 Object methods
49 type() This method returns the type field of the
50 Perl exacct object. The value of the type
51 field is returned as a dual-typed scalar and
52 is either EO_ITEM, EO_GROUP, or EO_NONE.
53
54
55 catalog() This method returns the catalog field of the
56 Perl exacct object. The value is returned as
57 a Sun::Solaris::Exacct::Catalog object.
58
59
60 match_catalog($catalog) This method matches the passed catalog tag
61 against the object. True is returned of a
62 match occurs. Otherwise false is returned.
63 This method has the same behavior as the
64 underlying ea_match_object_catalog(3EXACCT)
65 function.
66
67
68 value() This method returns the value of the Perl
69 exacct object. In the case of an Item, this
70 object will normally be a Perl scalar,
71 either a number or string. For raw Items,
72 the buffer contained inside the object is
73 returned as a Perl string that can be manip‐
74 ulated with the Perl unpack() function. If
75 the Item contains either a nested Item or a
76 nested Group, the enclosed Item is returned
77 as a reference to an object of the appropri‐
78 ate subtype of the
79 Sun::Solaris::Exacct::Object class.
80
81 For Group objects, if value() is called in a
82 scalar context, the return value is a refer‐
83 ence to the underlying array used to store
84 the component Items of the Group. Since this
85 array can be manipulated with the normal
86 Perl array indexing syntax and array opera‐
87 tors, the objects inside the Group can be
88 manipulated. All objects in the array must
89 be derived from the
90 Sun::Solaris::Exacct::Object class. Any
91 attempt to insert something else into the
92 array will generate a fatal runtime error
93 that can be caught with an eval { } block.
94
95 If value() is called in a list context for a
96 Group object, it returns a list of all the
97 objects in the Group. Unlike the array ref‐
98 erence returned in a scalar context, this
99 list cannot be manipulated to add or delete
100 Items from a Group. This mechanism is con‐
101 siderably faster than the array mechanism
102 described above and is the preferred mecha‐
103 nism if a Group is being examined in a read-
104 only manner.
105
106
107 Exports
108 By default nothing is exported from this module. The following tags can
109 be used to selectively import constants and functions defined in this
110 module:
111
112 :CONSTANTS EO_ERROR, EO_NONE, EO_ITEM, and EO_GROUP
113
114
115 :ALL :CONSTANTS
116
117
119 Example 1 Output of the dump() method for a Perl exacct Group object.
120
121
122 The following is an example of output of the dump() method for a Perl
123 exacct Group object.
124
125
126 GROUP
127 Catalog = EXT_GROUP|EXC_DEFAULT|EXD_GROUP_PROC_PARTIAL
128 ITEM
129 Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_PID
130 Value = 3
131 ITEM
132 Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_UID
133 Value = 0
134 ITEM
135 Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_GID
136 Value = 0
137 ITEM
138 Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_PROJID
139 Value = 0
140 ITEM
141 Catalog = EXT_UINT32|EXC_DEFAULT|EXD_PROC_TASKID
142 Value = 0
143 ITEM
144 Catalog = EXT_STRING|EXC_DEFAULT|EXD_PROC_COMMAND
145 Value = fsflush
146 ENDGROUP
147
148
150 See attributes(5) for descriptions of the following attributes:
151
152
153
154
155 ┌─────────────────────────────┬─────────────────────────────┐
156 │ ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
157 ├─────────────────────────────┼─────────────────────────────┤
158 │Availability │SUNWpl5u │
159 ├─────────────────────────────┼─────────────────────────────┤
160 │Interface Stability │Evolving │
161 └─────────────────────────────┴─────────────────────────────┘
162
164 ea_match_object_catalog(3EXACCT), Exacct(3PERL), Exacct::Cata‐
165 log(3PERL), Exacct::File(3PERL), Exacct::Object::Group(3PERL),
166 Exacct::Object::Item(3PERL), libexacct(3LIB), attributes(5)
167
168
169
170SunOS 5.11 1 Dec 2002 Exacct::Object(3PERL)