Commit | Line | Data |
e1eaa4ae |
1 | NAME |
2 | Class::Accessor::Grouped - Lets you build groups of accessors |
3 | |
4 | SYNOPSIS |
5 | DESCRIPTION |
6 | This class lets you build groups of accessors that will call different |
7 | getters and setters. |
8 | |
9 | METHODS |
10 | mk_group_accessors |
11 | Arguments: $group, @fieldspec |
12 | Returns: none |
13 | |
14 | Creates a set of accessors in a given group. |
15 | |
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) |
18 | on set. |
19 | |
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 ]. |
23 | |
24 | mk_group_ro_accessors |
25 | Arguments: $group, @fieldspec |
26 | Returns: none |
27 | |
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. |
31 | |
32 | mk_group_wo_accessors |
33 | Arguments: $group, @fieldspec |
34 | Returns: none |
35 | |
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. |
39 | |
40 | make_group_accessor |
41 | Arguments: $group, $field |
42 | Returns: $sub (\CODE) |
43 | |
44 | Returns a single accessor in a given group; called by mk_group_accessors |
45 | for each entry in @fieldspec. |
46 | |
47 | make_group_ro_accessor |
48 | Arguments: $group, $field |
49 | Returns: $sub (\CODE) |
50 | |
51 | Returns a single read-only accessor in a given group; called by |
52 | mk_group_ro_accessors for each entry in @fieldspec. |
53 | |
54 | make_group_wo_accessor |
55 | Arguments: $group, $field |
56 | Returns: $sub (\CODE) |
57 | |
58 | Returns a single write-only accessor in a given group; called by |
59 | mk_group_wo_accessors for each entry in @fieldspec. |
60 | |
61 | get_simple |
62 | Arguments: $field |
63 | Returns: $value |
64 | |
65 | Simple getter for hash-based objects which returns the value for the |
66 | field name passed as an argument. |
67 | |
68 | set_simple |
69 | Arguments: $field, $new_value |
70 | Returns: $new_value |
71 | |
72 | Simple setter for hash-based objects which sets and then returns the |
73 | value for the field name passed as an argument. |
74 | |
75 | get_inherited |
76 | Arguments: $field |
77 | Returns: $value |
78 | |
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 |
83 | object instances. |
84 | |
85 | set_inherited |
86 | Arguments: $field, $new_value |
87 | Returns: $new_value |
88 | |
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. |
93 | |
94 | Note:: This method will die if you try to set an object variable on a |
95 | non hash-based object. |
96 | |
331e820d |
97 | get_component_class |
98 | Arguments: $field |
99 | Returns: $value |
100 | |
101 | Gets the value of the specified component class. |
102 | |
103 | __PACKAGE__->mk_group_accessors('component_class' => 'result_class'); |
104 | |
105 | $self->result_class->method(); |
106 | |
107 | ## same as |
108 | $self->get_component_class('result_class')->method(); |
109 | |
110 | set_component_class |
111 | Arguments: $field, $class |
112 | Returns: $new_value |
113 | |
114 | Inherited accessor that automatically loads the specified class before |
115 | setting it. This method will die if the specified class could not be |
116 | loaded. |
117 | |
118 | __PACKAGE__->mk_group_accessors('component_class' => 'result_class'); |
119 | __PACKAGE__->result_class('MyClass'); |
120 | |
121 | $self->result_class->method(); |
122 | |
e1eaa4ae |
123 | get_super_paths |
124 | Returns a list of 'parent' or 'super' class names that the current class |
125 | inherited from. |
126 | |
127 | AUTHORS |
128 | Matt S. Trout <mst@shadowcatsystems.co.uk> Christopher H. Laco |
129 | <claco@chrislaco.com> |
130 | |
131 | LICENSE |
132 | You may distribute this code under the same terms as Perl itself. |
133 | |