File: README

package info (click to toggle)
libclass-accessor-grouped-perl 0.08001-1
  • links: PTS, VCS
  • area: main
  • in suites: lenny
  • size: 220 kB
  • ctags: 134
  • sloc: perl: 1,678; makefile: 43
file content (137 lines) | stat: -rw-r--r-- 4,282 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
NAME
    Class::Accessor::Grouped - Lets you build groups of accessors

SYNOPSIS
DESCRIPTION
    This class lets you build groups of accessors that will call different
    getters and setters.

METHODS
  mk_group_accessors
    Arguments: $group, @fieldspec
        Returns: none

    Creates a set of accessors in a given group.

    $group is the name of the accessor group for the generated accessors;
    they will call get_$group($field) on get and set_$group($field, $value)
    on set.

    If you want to mimic Class::Accessor's mk_accessors $group has to be
    'simple' to tell Class::Accessor::Grouped to use its own get_simple and
    set_simple methods.

    @fieldspec is a list of field/accessor names; if a fieldspec is a scalar
    this is used as both field and accessor name, if a listref it is
    expected to be of the form [ $accessor, $field ].

  mk_group_ro_accessors
    Arguments: $group, @fieldspec
        Returns: none

    Creates a set of read only accessors in a given group. Identical to
    <L:/mk_group_accessors> but accessors will throw an error if passed a
    value rather than setting the value.

  mk_group_wo_accessors
    Arguments: $group, @fieldspec
        Returns: none

    Creates a set of write only accessors in a given group. Identical to
    <L:/mk_group_accessors> but accessors will throw an error if not passed
    a value rather than getting the value.

  make_group_accessor
    Arguments: $group, $field
        Returns: $sub (\CODE)

    Returns a single accessor in a given group; called by mk_group_accessors
    for each entry in @fieldspec.

  make_group_ro_accessor
    Arguments: $group, $field
        Returns: $sub (\CODE)

    Returns a single read-only accessor in a given group; called by
    mk_group_ro_accessors for each entry in @fieldspec.

  make_group_wo_accessor
    Arguments: $group, $field
        Returns: $sub (\CODE)

    Returns a single write-only accessor in a given group; called by
    mk_group_wo_accessors for each entry in @fieldspec.

  get_simple
    Arguments: $field
        Returns: $value

    Simple getter for hash-based objects which returns the value for the
    field name passed as an argument.

  set_simple
    Arguments: $field, $new_value
        Returns: $new_value

    Simple setter for hash-based objects which sets and then returns the
    value for the field name passed as an argument.

  get_inherited
    Arguments: $field
        Returns: $value

    Simple getter for Classes and hash-based objects which returns the value
    for the field name passed as an argument. This behaves much like
    Class::Data::Accessor where the field can be set in a base class,
    inherited and changed in subclasses, and inherited and changed for
    object instances.

  set_inherited
    Arguments: $field, $new_value
        Returns: $new_value

    Simple setter for Classes and hash-based objects which sets and then
    returns the value for the field name passed as an argument. When called
    on a hash-based object it will set the appropriate hash key value. When
    called on a class, it will set a class level variable.

    Note:: This method will die if you try to set an object variable on a
    non hash-based object.

  get_component_class
    Arguments: $field
        Returns: $value

    Gets the value of the specified component class.

        __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
    
        $self->result_class->method();
    
        ## same as
        $self->get_component_class('result_class')->method();

  set_component_class
    Arguments: $field, $class
        Returns: $new_value

    Inherited accessor that automatically loads the specified class before
    setting it. This method will die if the specified class could not be
    loaded.

        __PACKAGE__->mk_group_accessors('component_class' => 'result_class');
        __PACKAGE__->result_class('MyClass');
    
        $self->result_class->method();

  get_super_paths
    Returns a list of 'parent' or 'super' class names that the current class
    inherited from.

AUTHORS
    Matt S. Trout <mst@shadowcatsystems.co.uk> Christopher H. Laco
    <claco@chrislaco.com>

LICENSE
    You may distribute this code under the same terms as Perl itself.