1MooseX::Emulate::Class:U:sAecrceCsosnotrr:i:bFuatsetdM(o3Po)esrelX:D:oEcmuumleanttea:t:iColnass::Accessor::Fast(3)
2
3
4

NAME

6       MooseX::Emulate::Class::Accessor::Fast - Emulate Class::Accessor::Fast
7       behavior using Moose attributes
8

SYNOPSYS

10           package MyClass;
11           use Moose;
12
13           with 'MooseX::Emulate::Class::Accessor::Fast';
14
15
16           #fields with readers and writers
17           __PACKAGE__->mk_accessors(qw/field1 field2/);
18           #fields with readers only
19           __PACKAGE__->mk_ro_accessors(qw/field3 field4/);
20           #fields with writers only
21           __PACKAGE__->mk_wo_accessors(qw/field5 field6/);
22

DESCRIPTION

24       This module attempts to emulate the behavior of Class::Accessor::Fast
25       as accurately as possible using the Moose attribute system. The public
26       API of "Class::Accessor::Fast" is wholly supported, but the private
27       methods are not.  If you are only using the public methods (as you
28       should) migration should be a matter of switching your "use base" line
29       to a "with" line.
30
31       While I have attempted to emulate the behavior of Class::Accessor::Fast
32       as closely as possible bugs may still be lurking in edge-cases.
33

BEHAVIOR

35       Simple documentation is provided here for your convenience, but for
36       more thorough documentation please see Class::Accessor::Fast and
37       Class::Accessor.
38
39   A note about introspection
40       Please note that, at this time, the "is" flag attribute is not being
41       set. To determine the "reader" and "writer" methods using introspection
42       in later versions of Class::MOP ( > 0.38) please use the
43       "get_read_method" and "get_write_method" methods in
44       Class::MOP::Attribute. Example
45
46           # with Class::MOP <= 0.38
47           my $attr = $self->meta->find_attribute_by_name($field_name);
48           my $reader_method = $attr->reader || $attr->accessor;
49           my $writer_method = $attr->writer || $attr->accessor;
50
51           # with Class::MOP > 0.38
52           my $attr = $self->meta->find_attribute_by_name($field_name);
53           my $reader_method = $attr->get_read_method;
54           my $writer_method = $attr->get_write_method;
55

METHODS

57   BUILD $self %args
58       Change the default Moose class building to emulate the behavior of
59       C::A::F and store arguments in the instance hashref.
60
61   mk_accessors @field_names
62       Create read-write accessors. An attribute named $field_name will be
63       created.  The name of the c<reader> and "writer" methods will be
64       determined by the return value of "accessor_name_for" and
65       "mutator_name_for", which by default return the name passed unchanged.
66       If the accessor and mutator names are equal the "accessor" attribute
67       will be passes to Moose, otherwise the "reader" and "writer" attributes
68       will be passed. Please see Class::MOP::Attribute for more information.
69
70   mk_ro_accessors @field_names
71       Create read-only accessors.
72
73   mk_ro_accessors @field_names
74       Create write-only accessors.
75
76   follow_best_practices
77       Preface readers with 'get_' and writers with 'set_'.  See original
78       Class::Accessor documentation for more information.
79
80   mutator_name_for
81   accessor_name_for
82       See original Class::Accessor documentation for more information.
83
84   set
85       See original Class::Accessor documentation for more information.
86
87   get
88       See original Class::Accessor documentation for more information.
89
90   meta
91       See Moose::Meta::Class.
92

SEE ALSO

94       Moose, Moose::Meta::Attribute, Class::Accessor, Class::Accessor::Fast,
95       Class::MOP::Attribute, MooseX::Adopt::Class::Accessor::Fast
96

AUTHORS

98       Guillermo Roditi (groditi) <groditi@cpan.org>
99
100       With contributions from:
101
102       Tomas Doran (t0m) <bobtfish@bobtfish.net>
103       Florian Ragwitz (rafl) <rafl@debian.org>
104

LICENSE

106       You may distribute this code under the same terms as Perl itself.
107
108
109
110perl v5.36.0                      2023M-o0o1s-e2X0::Emulate::Class::Accessor::Fast(3)
Impressum