1Class::Accessor::GroupeUds(e3r)Contributed Perl DocumentCaltaisosn::Accessor::Grouped(3)
2
3
4
6 Class::Accessor::Grouped - Lets you build groups of accessors
7
10 This class lets you build groups of accessors that will call different
11 getters and setters.
12
14 mk_group_accessors
15
16 Arguments: $group, @fieldspec
17 Returns: none
18
19 Creates a set of accessors in a given group.
20
21 $group is the name of the accessor group for the generated accessors;
22 they will call get_$group($field) on get and set_$group($field, $value)
23 on set.
24
25 @fieldspec is a list of field/accessor names; if a fieldspec is a
26 scalar this is used as both field and accessor name, if a listref it is
27 expected to be of the form [ $accessor, $field ].
28
29 mk_group_ro_accessors
30
31 Arguments: $group, @fieldspec
32 Returns: none
33
34 Creates a set of read only accessors in a given group. Identical to
35 <L:/mk_group_accessors> but accessors will throw an error if passed a
36 value rather than setting the value.
37
38 mk_group_wo_accessors
39
40 Arguments: $group, @fieldspec
41 Returns: none
42
43 Creates a set of write only accessors in a given group. Identical to
44 <L:/mk_group_accessors> but accessors will throw an error if not passed
45 a value rather than getting the value.
46
47 make_group_accessor
48
49 Arguments: $group, $field
50 Returns: $sub (\CODE)
51
52 Returns a single accessor in a given group; called by mk_group_accesâ
53 sors for each entry in @fieldspec.
54
55 make_group_ro_accessor
56
57 Arguments: $group, $field
58 Returns: $sub (\CODE)
59
60 Returns a single read-only accessor in a given group; called by
61 mk_group_ro_accessors for each entry in @fieldspec.
62
63 make_group_wo_accessor
64
65 Arguments: $group, $field
66 Returns: $sub (\CODE)
67
68 Returns a single write-only accessor in a given group; called by
69 mk_group_wo_accessors for each entry in @fieldspec.
70
71 get_simple
72
73 Arguments: $field
74 Returns: $value
75
76 Simple getter for hash-based objects which returns the value for the
77 field name passed as an argument.
78
79 set_simple
80
81 Arguments: $field, $new_value
82 Returns: $new_value
83
84 Simple setter for hash-based objects which sets and then returns the
85 value for the field name passed as an argument.
86
87 get_inherited
88
89 Arguments: $field
90 Returns: $value
91
92 Simple getter for Classes and hash-based objects which returns the
93 value for the field name passed as an argument. This behaves much like
94 Class::Data::Accessor where the field can be set in a base class,
95 inherited and changed in subclasses, and inherited and changed for
96 object instances.
97
98 set_inherited
99
100 Arguments: $field, $new_value
101 Returns: $new_value
102
103 Simple setter for Classes and hash-based objects which sets and then
104 returns the value for the field name passed as an argument. When called
105 on a hash-based object it will set the appropriate hash key value. When
106 called on a class, it will set a class level variable.
107
108 Note:: This method will die if you try to set an object variable on a
109 non hash-based object.
110
111 get_component_class
112
113 Arguments: $field
114 Returns: $value
115
116 Gets the value of the specified component class.
117
118 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
119
120 $self->result_class->method();
121
122 ## same as
123 $self->get_component_class('result_class')->method();
124
125 set_component_class
126
127 Arguments: $field, $class
128 Returns: $new_value
129
130 Inherited accessor that automatically loads the specified class before
131 setting it. This method will die if the specified class could not be
132 loaded.
133
134 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
135 __PACKAGE__->result_class('MyClass');
136
137 $self->result_class->method();
138
139 get_super_paths
140
141 Returns a list of 'parent' or 'super' class names that the current
142 class inherited from.
143
145 Matt S. Trout <mst@shadowcatsystems.co.uk> Christopher H. Laco
146 <claco@chrislaco.com>
147
149 You may distribute this code under the same terms as Perl itself.
150
151
152
153perl v5.8.8 2007-07-02 Class::Accessor::Grouped(3)