1Class::MOP::Method::AccUessesrorC(o3n)tributed Perl DocuCmleanstsa:t:iMoOnP::Method::Accessor(3)
2
3
4
6 Class::MOP::Method::Accessor - Method Meta Object for accessors
7
9 version 2.2201
10
12 use Class::MOP::Method::Accessor;
13
14 my $reader = Class::MOP::Method::Accessor->new(
15 attribute => $attribute,
16 is_inline => 1,
17 accessor_type => 'reader',
18 );
19
20 $reader->body->execute($instance); # call the reader method
21
23 This is a subclass of "Class::MOP::Method" which is used by
24 "Class::MOP::Attribute" to generate accessor code. It handles
25 generation of readers, writers, predicates and clearers. For each type
26 of method, it can either create a subroutine reference, or actually
27 inline code by generating a string and "eval"'ing it.
28
30 Class::MOP::Method::Accessor->new(%options)
31 This returns a new "Class::MOP::Method::Accessor" based on the
32 %options provided.
33
34 • attribute
35
36 This is the "Class::MOP::Attribute" for which accessors are
37 being generated. This option is required.
38
39 • accessor_type
40
41 This is a string which should be one of "reader", "writer",
42 "accessor", "predicate", or "clearer". This is the type of
43 method being generated. This option is required.
44
45 • is_inline
46
47 This indicates whether or not the accessor should be inlined.
48 This defaults to false.
49
50 • name
51
52 The method name (without a package name). This is required.
53
54 • package_name
55
56 The package name for the method. This is required.
57
58 $metamethod->accessor_type
59 Returns the accessor type which was passed to "new".
60
61 $metamethod->is_inline
62 Returns a boolean indicating whether or not the accessor is
63 inlined.
64
65 $metamethod->associated_attribute
66 This returns the Class::MOP::Attribute object which was passed to
67 "new".
68
69 $metamethod->body
70 The method itself is generated when the accessor object is
71 constructed.
72
74 • Stevan Little <stevan@cpan.org>
75
76 • Dave Rolsky <autarch@urth.org>
77
78 • Jesse Luehrs <doy@cpan.org>
79
80 • Shawn M Moore <sartak@cpan.org>
81
82 • יובל קוג'מן (Yuval Kogman) <nothingmuch@woobling.org>
83
84 • Karen Etheridge <ether@cpan.org>
85
86 • Florian Ragwitz <rafl@debian.org>
87
88 • Hans Dieter Pearcey <hdp@cpan.org>
89
90 • Chris Prather <chris@prather.org>
91
92 • Matt S Trout <mstrout@cpan.org>
93
95 This software is copyright (c) 2006 by Infinity Interactive, Inc.
96
97 This is free software; you can redistribute it and/or modify it under
98 the same terms as the Perl 5 programming language system itself.
99
100
101
102perl v5.34.0 2022-01-21 Class::MOP::Method::Accessor(3)