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 use Class::MOP::Method::Accessor;
10
11 my $reader = Class::MOP::Method::Accessor->new(
12 attribute => $attribute,
13 is_inline => 1,
14 accessor_type => 'reader',
15 );
16
17 $reader->body->execute($instance); # call the reader method
18
20 This is a subclass of <Class::MOP::Method> which is used by
21 "Class::MOP::Attribute" to generate accessor code. It handles
22 generation of readers, writers, predicates and clearers. For each type
23 of method, it can either create a subroutine reference, or actually
24 inline code by generating a string and "eval"'ing it.
25
27 Class::MOP::Method::Accessor->new(%options)
28 This returns a new "Class::MOP::Method::Accessor" based on the
29 %options provided.
30
31 · attribute
32
33 This is the "Class::MOP::Attribute" for which accessors are
34 being generated. This option is required.
35
36 · accessor_type
37
38 This is a string which should be one of "reader", "writer",
39 "accessor", "predicate", or "clearer". This is the type of
40 method being generated. This option is required.
41
42 · is_inline
43
44 This indicates whether or not the accessor should be inlined.
45 This defaults to false.
46
47 · name
48
49 The method name (without a package name). This is required.
50
51 · package_name
52
53 The package name for the method. This is required.
54
55 $metamethod->accessor_type
56 Returns the accessor type which was passed to "new".
57
58 $metamethod->is_inline
59 Returns a boolean indicating whether or not the accessor is
60 inlined.
61
62 $metamethod->associated_attribute
63 This returns the Class::MOP::Attribute object which was passed to
64 "new".
65
66 $metamethod->body
67 The method itself is generated when the accessor object is
68 constructed.
69
71 Stevan Little <stevan@iinteractive.com>
72
74 Copyright 2006-2010 by Infinity Interactive, Inc.
75
76 <http://www.iinteractive.com>
77
78 This library is free software; you can redistribute it and/or modify it
79 under the same terms as Perl itself.
80
81
82
83perl v5.12.2 2010-09-13 Class::MOP::Method::Accessor(3)