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->($instance); # call the reader method
18
20 This is a "Class::MOP::Method" subclass which is used interally by
21 "Class::MOP::Attribute" to generate accessor code. It can handle gener‐
22 ation of readers, writers, predicate and clearer methods, both as clo‐
23 sures and as more optimized inline methods.
24
26 new (%options)
27 This creates the method based on the criteria in %options, these
28 options are:
29
30 attribute
31 This must be an instance of "Class::MOP::Attribute" which this
32 accessor is being generated for. This paramter is required.
33
34 accessor_type
35 This is a string from the following set; reader, writer, acces‐
36 sor, predicate or clearer. This is used to determine which type
37 of method is to be generated.
38
39 is_inline
40 This is a boolean to indicate if the method should be generated
41 as a closure, or as a more optimized inline version.
42
43 accessor_type
44 This returns the accessor type which was passed into "new".
45
46 is_inline
47 This returns the boolean which was passed into "new".
48
49 associated_attribute
50 This returns the attribute instance which was passed into "new".
51
52 initialize_body
53 This will actually generate the method based on the specified cri‐
54 teria passed to the constructor.
55
56 Method Generators
57
58 These methods will generate appropriate code references for the various
59 types of accessors which are supported by "Class::MOP::Attribute". The
60 names pretty much explain it all.
61
62 generate_accessor_method
63 generate_accessor_method_inline
64 generate_clearer_method
65 generate_clearer_method_inline
66 generate_predicate_method
67 generate_predicate_method_inline
68 generate_reader_method
69 generate_reader_method_inline
70 generate_writer_method
71 generate_writer_method_inline
72
74 Stevan Little <stevan@iinteractive.com>
75
77 Copyright 2006, 2007 by Infinity Interactive, Inc.
78
79 <http://www.iinteractive.com>
80
81 This library is free software; you can redistribute it and/or modify it
82 under the same terms as Perl itself.
83
84
85
86perl v5.8.8 2007-11-07 Class::MOP::Method::Accessor(3)