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