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 If you want to mimic Class::Accessor's mk_accessors $group has to be
21 'simple' to tell Class::Accessor::Grouped to use its own get_simple and
24 @fieldspec is a list of field/accessor names; if a fieldspec is a scalar
25 this is used as both field and accessor name, if a listref it is
26 expected to be of the form [ $accessor, $field ].
29 Arguments: $group, @fieldspec
32 Creates a set of read only accessors in a given group. Identical to
33 <L:/mk_group_accessors> but accessors will throw an error if passed a
34 value rather than setting the value.
37 Arguments: $group, @fieldspec
40 Creates a set of write only accessors in a given group. Identical to
41 <L:/mk_group_accessors> but accessors will throw an error if not passed
42 a value rather than getting the value.
45 Arguments: $group, $field
48 Returns a single accessor in a given group; called by mk_group_accessors
49 for each entry in @fieldspec.
51 make_group_ro_accessor
52 Arguments: $group, $field
55 Returns a single read-only accessor in a given group; called by
56 mk_group_ro_accessors for each entry in @fieldspec.
58 make_group_wo_accessor
59 Arguments: $group, $field
62 Returns a single write-only accessor in a given group; called by
63 mk_group_wo_accessors for each entry in @fieldspec.
69 Simple getter for hash-based objects which returns the value for the
70 field name passed as an argument.
73 Arguments: $field, $new_value
76 Simple setter for hash-based objects which sets and then returns the
77 value for the field name passed as an argument.
83 Simple getter for Classes and hash-based objects which returns the value
84 for the field name passed as an argument. This behaves much like
85 Class::Data::Accessor where the field can be set in a base class,
86 inherited and changed in subclasses, and inherited and changed for
90 Arguments: $field, $new_value
93 Simple setter for Classes and hash-based objects which sets and then
94 returns the value for the field name passed as an argument. When called
95 on a hash-based object it will set the appropriate hash key value. When
96 called on a class, it will set a class level variable.
98 Note:: This method will die if you try to set an object variable on a
99 non hash-based object.
105 Gets the value of the specified component class.
107 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
109 $self->result_class->method();
112 $self->get_component_class('result_class')->method();
115 Arguments: $field, $class
118 Inherited accessor that automatically loads the specified class before
119 setting it. This method will die if the specified class could not be
122 __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
123 __PACKAGE__->result_class('MyClass');
125 $self->result_class->method();
128 Returns a list of 'parent' or 'super' class names that the current class
132 Matt S. Trout <mst@shadowcatsystems.co.uk> Christopher H. Laco
133 <claco@chrislaco.com>
136 You may distribute this code under the same terms as Perl itself.