1 package MooseX::SemiAffordanceAccessor::Role::Attribute;
9 before '_process_options' => sub
15 if ( exists $options->{is} &&
16 ! ( exists $options->{reader} || exists $options->{writer} ) )
18 if ( $options->{is} eq 'ro' )
20 $options->{reader} = $name;
21 delete $options->{is};
23 elsif ( $options->{is} eq 'rw' )
25 $options->{reader} = $name;
28 if ( $name =~ s/^_// )
33 $options->{writer} = $prefix . q{_} . $name;
34 delete $options->{is};
45 MooseX::SemiAffordanceAccessor::Role::Attribute - Names accessors in a semi-affordance style
49 Moose::Util::MetaRole::apply_metaclass_roles
50 ( for_class => $p{for_class},
51 attribute_metaclass_roles =>
52 ['MooseX::SemiAffordanceAccessor::Role::Attribute'],
57 This role applies a method modifier to the C<_process_options()>
58 method, and tweaks the reader and writer parameters so that they
59 follow the semi-affordance naming style.
63 Dave Rolsky, C<< <autarch@urth.org> >>
65 =head1 COPYRIGHT & LICENSE
67 Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
69 This program is free software; you can redistribute it and/or modify
70 it under the same terms as Perl itself.