Use applied_attribute metarole with Moose 1.9900+
[gitmo/MooseX-SemiAffordanceAccessor.git] / lib / MooseX / SemiAffordanceAccessor.pm
CommitLineData
b95d9f9b 1package MooseX::SemiAffordanceAccessor;
2
3use strict;
4use warnings;
5
7891bc29 6use Moose 0.94 ();
b95d9f9b 7use Moose::Exporter;
8use Moose::Util::MetaRole;
9use MooseX::SemiAffordanceAccessor::Role::Attribute;
10
8a1964e9 11my %metaroles = (
5177f5e0 12 class_metaroles => {
13 attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'],
14 },
080d1e6d 15 role_metaroles => {
16 applied_attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'],
17 },
5177f5e0 18);
b95d9f9b 19
8a1964e9 20$metaroles{role_metaroles} = {
21 applied_attribute => ['MooseX::SemiAffordanceAccessor::Role::Attribute'],
22} if $Moose::VERSION >= 1.9900;
23
24Moose::Exporter->setup_import_methods(%metaroles);
25
b95d9f9b 261;
27
5177f5e0 28# ABSTRACT: Name your accessors foo() and set_foo()
29
b95d9f9b 30__END__
31
32=pod
33
b95d9f9b 34=head1 SYNOPSIS
35
b95d9f9b 36 use Moose;
8d547f46 37 use MooseX::SemiAffordanceAccessor;
b95d9f9b 38
39 # make some attributes
40
41=head1 DESCRIPTION
42
43This module does not provide any methods. Simply loading it changes
44the default naming policy for the loading class so that accessors are
45separated into get and set methods. The get methods have the same name
46as the accessor, while set methods are prefixed with "set_".
47
48If you define an attribute with a leading underscore, then the set
49method will start with "_set_".
50
51If you explicitly set a "reader" or "writer" name when creating an
52attribute, then that attribute's naming scheme is left unchanged.
53
54The name "semi-affordance" comes from David Wheeler's Class::Meta
55module.
56
b95d9f9b 57=head1 BUGS
58
59Please report any bugs or feature requests to
60C<bug-moosex-semiaffordanceaccessor@rt.cpan.org>, or through
61the web interface at L<http://rt.cpan.org>. I will be notified, and
62then you'll automatically be notified of progress on your bug as I
63make changes.
64
b95d9f9b 65=cut