2 Class::Accessor::Grouped - Lets you build groups of accessors
6 This class lets you build groups of accessors that will call different
11 Arguments: $group, @fieldspec
14 Creates a set of accessors in a given group.
16 $group is the name of the accessor group for the generated accessors;
17 they will call get_$group($field) on get and set_$group($field, $value)
20 @fieldspec is a list of field/accessor names; if a fieldspec is a scalar
21 this is used as both field and accessor name, if a listref it is
22 expected to be of the form [ $accessor, $field ].
25 Arguments: $group, @fieldspec
28 Creates a set of read only accessors in a given group. Identical to
29 <L:/mk_group_accessors> but accessors will throw an error if passed a
30 value rather than setting the value.
33 Arguments: $group, @fieldspec
36 Creates a set of write only accessors in a given group. Identical to
37 <L:/mk_group_accessors> but accessors will throw an error if not passed
38 a value rather than getting the value.
41 Arguments: $group, $field
44 Returns a single accessor in a given group; called by mk_group_accessors
45 for each entry in @fieldspec.
47 make_group_ro_accessor
48 Arguments: $group, $field
51 Returns a single read-only accessor in a given group; called by
52 mk_group_ro_accessors for each entry in @fieldspec.
54 make_group_wo_accessor
55 Arguments: $group, $field
58 Returns a single write-only accessor in a given group; called by
59 mk_group_wo_accessors for each entry in @fieldspec.
65 Simple getter for hash-based objects which returns the value for the
66 field name passed as an argument.
69 Arguments: $field, $new_value
72 Simple setter for hash-based objects which sets and then returns the
73 value for the field name passed as an argument.
79 Simple getter for Classes and hash-based objects which returns the value
80 for the field name passed as an argument. This behaves much like
81 Class::Data::Accessor where the field can be set in a base class,
82 inherited and changed in subclasses, and inherited and changed for
86 Arguments: $field, $new_value
89 Simple setter for Classes and hash-based objects which sets and then
90 returns the value for the field name passed as an argument. When called
91 on a hash-based object it will set the appropriate hash key value. When
92 called on a class, it will set a class level variable.
94 Note:: This method will die if you try to set an object variable on a
95 non hash-based object.
101 Gets the value of the specified component class.
103 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
105 $self->result_class->method();
108 $self->get_component_class('result_class')->method();
111 Arguments: $field, $class
114 Inherited accessor that automatically loads the specified class before
115 setting it. This method will die if the specified class could not be
118 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
119 __PACKAGE__->result_class('MyClass');
121 $self->result_class->method();
124 Returns a list of 'parent' or 'super' class names that the current class
128 Matt S. Trout <mst@shadowcatsystems.co.uk> Christopher H. Laco
129 <claco@chrislaco.com>
132 You may distribute this code under the same terms as Perl itself.