1 package MooseX::ClassAttribute::Meta::Method::Accessor;
6 use namespace::autoclean;
9 extends 'Moose::Meta::Method::Accessor';
11 sub _generate_predicate_method_inline {
12 my $attr = (shift)->associated_attribute;
16 . $attr->associated_class()
17 ->inline_is_class_slot_initialized( $attr->name() ) . '}';
19 confess "Could not generate inline predicate because : $@" if $@;
24 sub _generate_clearer_method_inline {
25 my $attr = (shift)->associated_attribute;
26 my $meta_instance = $attr->associated_class->instance_metaclass;
30 . $attr->associated_class()
31 ->inline_deinitialize_class_slot( $attr->name() ) . '}';
33 confess "Could not generate inline clearer because : $@" if $@;
43 my $attr = $self->associated_attribute();
45 my $meta = $attr->associated_class();
48 = $meta->inline_set_class_slot_value( $attr->slots(), $value ) . ";";
50 .= $meta->inline_weaken_class_slot_value( $attr->slots(), $value )
52 if $attr->is_weak_ref();
60 my $attr = $self->associated_attribute;
61 my $meta = $attr->associated_class();
63 return $meta->inline_get_class_slot_value( $attr->slots() );
69 my $attr = $self->associated_attribute;
70 my $meta = $attr->associated_class();
72 return $meta->inline_class_slot_access( $attr->slots() );
78 my $attr = $self->associated_attribute;
79 my $meta = $attr->associated_class();
81 return $meta->inline_is_class_slot_initialized( $attr->slots() );
84 sub _inline_init_slot {
87 return $self->_inline_store( undef, $_[-1] );
90 sub _inline_check_lazy {
93 return $self->SUPER::_inline_check_lazy( q{'}
94 . $self->associated_attribute()->associated_class()->name()
98 sub _inline_get_old_value_for_trigger {
101 my $attr = $self->associated_attribute();
102 return '' unless $attr->has_trigger();
104 my $pred = $attr->associated_class()
105 ->inline_is_class_slot_initialized( $attr->name() );
110 . $self->_inline_get()
121 MooseX::ClassAttribute::Meta::Method::Accessor - Accessor method generation for class attributes
125 This class overrides L<Moose::Meta::Method::Accessor> to do code
126 generation properly for class attributes.
130 Dave Rolsky, C<< <autarch@urth.org> >>
134 See L<MooseX::ClassAttribute> for details.
136 =head1 COPYRIGHT & LICENSE
138 Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
140 This program is free software; you can redistribute it and/or modify
141 it under the same terms as Perl itself.