1 package MooseX::ClassAttribute::Meta::Method::Accessor;
8 extends 'Moose::Meta::Method::Accessor';
11 sub generate_predicate_method_inline
13 my $attr = (shift)->associated_attribute;
14 my $attr_name = $attr->name;
18 . $attr->associated_class()->inline_is_class_slot_initialized( "'$attr_name'" )
21 confess "Could not generate inline predicate because : $@" if $@;
26 sub generate_clearer_method_inline
28 my $attr = (shift)->associated_attribute;
29 my $attr_name = $attr->name;
30 my $meta_instance = $attr->associated_class->instance_metaclass;
34 . $attr->associated_class()->inline_deinitialize_class_slot( "'$attr_name'" )
37 confess "Could not generate inline clearer because : $@" if $@;
48 my $attr = $self->associated_attribute();
50 my $slot_name = sprintf "'%s'", $attr->slots();
52 my $meta = $attr->associated_class();
54 my $code = $meta->inline_set_class_slot_value($slot_name, $value) . ";";
55 $code .= $meta->inline_weaken_class_slot_value($slot_name, $value) . ";"
56 if $attr->is_weak_ref();
65 my $attr = $self->associated_attribute;
66 my $meta = $attr->associated_class();
68 my $slot_name = sprintf "'%s'", $attr->slots;
70 return $meta->inline_get_class_slot_value($slot_name);
77 my $attr = $self->associated_attribute;
78 my $meta = $attr->associated_class();
80 my $slot_name = sprintf "'%s'", $attr->slots;
82 return $meta->inline_class_slot_access($slot_name);
89 my $attr = $self->associated_attribute;
90 my $meta = $attr->associated_class();
92 my $slot_name = sprintf "'%s'", $attr->slots;
94 return $meta->inline_is_class_slot_initialized($slot_name);
101 return $self->_inline_store( undef, $_[-1] );
104 sub _inline_check_lazy
109 $self->SUPER::_inline_check_lazy
110 ( q{'} . $self->associated_attribute()->associated_class()->name() . q{'} );
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.