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