2 package Moose::Meta::Method::Accessor;
9 use base 'Moose::Meta::Method',
10 'Class::MOP::Method::Accessor';
14 return $self->associated_attribute
15 if ref($self) && defined($self->associated_attribute);
16 return $self->SUPER::_error_thrower;
23 $self->SUPER::_compile_code(@args);
27 'Could not create writer for '
28 . "'" . $self->associated_attribute->name . "' "
35 sub _eval_environment {
38 my $attr = $self->associated_attribute;
39 my $type_constraint_obj = $attr->type_constraint;
44 '$type_constraint_obj' => \$type_constraint_obj,
45 '$type_constraint' => \(
47 ? $type_constraint_obj->_compiled_type_constraint
53 sub _instance_is_inlinable {
55 return $self->associated_attribute->associated_class->instance_metaclass->is_inlinable;
58 sub _generate_reader_method {
60 $self->_instance_is_inlinable ? $self->_generate_reader_method_inline(@_)
61 : $self->SUPER::_generate_reader_method(@_);
64 sub _generate_writer_method {
66 $self->_instance_is_inlinable ? $self->_generate_writer_method_inline(@_)
67 : $self->SUPER::_generate_writer_method(@_);
70 sub _generate_accessor_method {
72 $self->_instance_is_inlinable ? $self->_generate_accessor_method_inline(@_)
73 : $self->SUPER::_generate_accessor_method(@_);
76 sub _generate_predicate_method {
78 $self->_instance_is_inlinable ? $self->_generate_predicate_method_inline(@_)
79 : $self->SUPER::_generate_predicate_method(@_);
82 sub _generate_clearer_method {
84 $self->_instance_is_inlinable ? $self->_generate_clearer_method_inline(@_)
85 : $self->SUPER::_generate_clearer_method(@_);
88 sub _writer_value_needs_copy {
89 shift->associated_attribute->_writer_value_needs_copy(@_);
93 shift->associated_attribute->_inline_tc_code(@_);
96 sub _inline_check_constraint {
97 shift->associated_attribute->_inline_check_constraint(@_);
100 sub _inline_check_lazy {
101 shift->associated_attribute->_inline_check_lazy(@_);
104 sub _inline_store_value {
105 shift->associated_attribute->_inline_instance_set(@_) . ';';
108 sub _inline_get_old_value_for_trigger {
109 shift->associated_attribute->_inline_get_old_value_for_trigger(@_);
112 sub _inline_trigger {
113 shift->associated_attribute->_inline_trigger(@_);
117 shift->associated_attribute->_inline_instance_get(@_);
121 shift->associated_attribute->_inline_instance_has(@_);
126 # ABSTRACT: A Moose Method metaclass for accessors
134 This class is a subclass of L<Class::MOP::Method::Accessor> that
135 provides additional Moose-specific functionality, all of which is
138 To understand this class, you should read the the
139 L<Class::MOP::Method::Accessor> documentation.
143 See L<Moose/BUGS> for details on reporting bugs.