2 package Moose::Meta::Method::Accessor;
9 our $VERSION = '1.9900';
10 $VERSION = eval $VERSION;
11 our $AUTHORITY = 'cpan:STEVAN';
13 use base 'Moose::Meta::Method',
14 'Class::MOP::Method::Accessor';
18 return $self->associated_attribute
19 if ref($self) && defined($self->associated_attribute);
20 return $self->SUPER::_error_thrower;
27 $self->SUPER::_compile_code(@args);
31 'Could not create writer for '
32 . "'" . $self->associated_attribute->name . "' "
39 sub _eval_environment {
42 my $attr = $self->associated_attribute;
43 my $type_constraint_obj = $attr->type_constraint;
48 '$type_constraint_obj' => \$type_constraint_obj,
49 '$type_constraint' => \(
51 ? $type_constraint_obj->_compiled_type_constraint
57 sub _instance_is_inlinable {
59 return $self->associated_attribute->associated_class->instance_metaclass->is_inlinable;
62 sub _generate_reader_method {
64 $self->_instance_is_inlinable ? $self->_generate_reader_method_inline(@_)
65 : $self->SUPER::_generate_reader_method(@_);
68 sub _generate_writer_method {
70 $self->_instance_is_inlinable ? $self->_generate_writer_method_inline(@_)
71 : $self->SUPER::_generate_writer_method(@_);
74 sub _generate_accessor_method {
76 $self->_instance_is_inlinable ? $self->_generate_accessor_method_inline(@_)
77 : $self->SUPER::_generate_accessor_method(@_);
80 sub _generate_predicate_method {
82 $self->_instance_is_inlinable ? $self->_generate_predicate_method_inline(@_)
83 : $self->SUPER::_generate_predicate_method(@_);
86 sub _generate_clearer_method {
88 $self->_instance_is_inlinable ? $self->_generate_clearer_method_inline(@_)
89 : $self->SUPER::_generate_clearer_method(@_);
92 sub _writer_value_needs_copy {
93 shift->associated_attribute->_writer_value_needs_copy(@_);
97 shift->associated_attribute->_inline_tc_code(@_);
100 sub _inline_check_constraint {
101 shift->associated_attribute->_inline_check_constraint(@_);
104 sub _inline_check_lazy {
105 shift->associated_attribute->_inline_check_lazy(@_);
108 sub _inline_store_value {
109 shift->associated_attribute->_inline_instance_set(@_) . ';';
112 sub _inline_get_old_value_for_trigger {
113 shift->associated_attribute->_inline_get_old_value_for_trigger(@_);
116 sub _inline_trigger {
117 shift->associated_attribute->_inline_trigger(@_);
121 shift->associated_attribute->_inline_instance_get(@_);
125 shift->associated_attribute->_inline_instance_has(@_);
136 Moose::Meta::Method::Accessor - A Moose Method metaclass for accessors
140 This class is a subclass of L<Class::MOP::Method::Accessor> that
141 provides additional Moose-specific functionality, all of which is
144 To understand this class, you should read the the
145 L<Class::MOP::Method::Accessor> documentation.
149 See L<Moose/BUGS> for details on reporting bugs.
153 Stevan Little E<lt>stevan@iinteractive.comE<gt>
155 Yuval Kogman E<lt>nothingmuch@woobling.comE<gt>
157 =head1 COPYRIGHT AND LICENSE
159 Copyright 2006-2010 by Infinity Interactive, Inc.
161 L<http://www.iinteractive.com>
163 This library is free software; you can redistribute it and/or modify
164 it under the same terms as Perl itself.