run all code through perltidy
[gitmo/MooseX-SemiAffordanceAccessor.git] / lib / MooseX / SemiAffordanceAccessor.pm
CommitLineData
b95d9f9b 1package MooseX::SemiAffordanceAccessor;
2
3use strict;
4use warnings;
5
de3787ed 6our $VERSION = '0.05';
b95d9f9b 7
0a613fc0 8use Moose 0.84 ();
b95d9f9b 9use Moose::Exporter;
10use Moose::Util::MetaRole;
11use MooseX::SemiAffordanceAccessor::Role::Attribute;
12
13# The main reason to use this is to ensure that we get the right value
14# in $p{for_class} later.
15Moose::Exporter->setup_import_methods();
16
f227d76f 17sub init_meta {
b95d9f9b 18 shift;
19 my %p = @_;
20
21 Moose->init_meta(%p);
22
f227d76f 23 return Moose::Util::MetaRole::apply_metaclass_roles(
24 for_class => $p{for_class},
25 attribute_metaclass_roles =>
26 ['MooseX::SemiAffordanceAccessor::Role::Attribute'],
27 );
b95d9f9b 28}
29
b95d9f9b 301;
31
32__END__
33
34=pod
35
36=head1 NAME
37
38MooseX::SemiAffordanceAccessor - Name your accessors foo() and set_foo()
39
40=head1 SYNOPSIS
41
42 use MooseX::SemiAffordanceAccessor;
43 use Moose;
44
45 # make some attributes
46
47=head1 DESCRIPTION
48
49This module does not provide any methods. Simply loading it changes
50the default naming policy for the loading class so that accessors are
51separated into get and set methods. The get methods have the same name
52as the accessor, while set methods are prefixed with "set_".
53
54If you define an attribute with a leading underscore, then the set
55method will start with "_set_".
56
57If you explicitly set a "reader" or "writer" name when creating an
58attribute, then that attribute's naming scheme is left unchanged.
59
60The name "semi-affordance" comes from David Wheeler's Class::Meta
61module.
62
63=head1 AUTHOR
64
65Dave Rolsky, C<< <autarch@urth.org> >>
66
67=head1 BUGS
68
69Please report any bugs or feature requests to
70C<bug-moosex-semiaffordanceaccessor@rt.cpan.org>, or through
71the web interface at L<http://rt.cpan.org>. I will be notified, and
72then you'll automatically be notified of progress on your bug as I
73make changes.
74
75=head1 COPYRIGHT & LICENSE
76
31d1505c 77Copyright 2007-2008 Dave Rolsky, All Rights Reserved.
b95d9f9b 78
79This program is free software; you can redistribute it and/or modify
80it under the same terms as Perl itself.
81
82=cut