2 package Moose::Meta::Method::Accessor;
9 our $AUTHORITY = 'cpan:STEVAN';
11 use base 'Moose::Meta::Method',
12 'Class::MOP::Method::Accessor';
16 return $self->associated_attribute
17 if ref($self) && defined($self->associated_attribute);
18 return $self->SUPER::_error_thrower;
25 $self->SUPER::_compile_code(@args);
29 'Could not create writer for '
30 . "'" . $self->associated_attribute->name . "' "
37 sub _eval_environment {
40 my $attr = $self->associated_attribute;
41 my $type_constraint_obj = $attr->type_constraint;
46 '$type_constraint_obj' => \$type_constraint_obj,
47 '$type_constraint' => \(
49 ? $type_constraint_obj->_compiled_type_constraint
55 sub _instance_is_inlinable {
57 return $self->associated_attribute->associated_class->instance_metaclass->is_inlinable;
60 sub _generate_reader_method {
62 $self->_instance_is_inlinable ? $self->_generate_reader_method_inline(@_)
63 : $self->SUPER::_generate_reader_method(@_);
66 sub _generate_writer_method {
68 $self->_instance_is_inlinable ? $self->_generate_writer_method_inline(@_)
69 : $self->SUPER::_generate_writer_method(@_);
72 sub _generate_accessor_method {
74 $self->_instance_is_inlinable ? $self->_generate_accessor_method_inline(@_)
75 : $self->SUPER::_generate_accessor_method(@_);
78 sub _generate_predicate_method {
80 $self->_instance_is_inlinable ? $self->_generate_predicate_method_inline(@_)
81 : $self->SUPER::_generate_predicate_method(@_);
84 sub _generate_clearer_method {
86 $self->_instance_is_inlinable ? $self->_generate_clearer_method_inline(@_)
87 : $self->SUPER::_generate_clearer_method(@_);
90 sub _writer_value_needs_copy {
91 shift->associated_attribute->_writer_value_needs_copy(@_);
95 shift->associated_attribute->_inline_tc_code(@_);
98 sub _inline_check_constraint {
99 shift->associated_attribute->_inline_check_constraint(@_);
102 sub _inline_check_lazy {
103 shift->associated_attribute->_inline_check_lazy(@_);
106 sub _inline_store_value {
107 shift->associated_attribute->_inline_instance_set(@_) . ';';
110 sub _inline_get_old_value_for_trigger {
111 shift->associated_attribute->_inline_get_old_value_for_trigger(@_);
114 sub _inline_trigger {
115 shift->associated_attribute->_inline_trigger(@_);
119 shift->associated_attribute->_inline_instance_get(@_);
123 shift->associated_attribute->_inline_instance_has(@_);
128 # ABSTRACT: A Moose Method metaclass for accessors
136 This class is a subclass of L<Class::MOP::Method::Accessor> that
137 provides additional Moose-specific functionality, all of which is
140 To understand this class, you should read the the
141 L<Class::MOP::Method::Accessor> documentation.
145 See L<Moose/BUGS> for details on reporting bugs.