2 package MooseX::AttributeHelpers;
5 our $AUTHORITY = 'cpan:STEVAN';
7 use MooseX::AttributeHelpers::Meta::Method::Provided;
9 use MooseX::AttributeHelpers::Counter;
10 use MooseX::AttributeHelpers::Number;
11 use MooseX::AttributeHelpers::Collection::Array;
12 use MooseX::AttributeHelpers::Collection::Hash;
22 MooseX::AttributeHelpers - Extend your attribute interfaces
28 use MooseX::AttributeHelpers;
31 metaclass => 'Collection::Hash',
33 isa => 'HashRef[Str]',
34 default => sub { {} },
36 exists => 'exists_in_mapping',
37 keys => 'ids_in_mapping',
45 my $obj = MyClass->new;
46 $obj->set_mapping(4, 'foo');
47 $obj->set_mapping(5, 'bar');
48 $obj->set_mapping(6, 'baz');
51 print $obj->get_mapping(5) if $obj->exists_in_mapping(5);
54 print join ', ', $obj->ids_in_mapping;
58 While L<Moose> attributes provide you with a way to name your accessors,
59 readers, writers, clearers and predicates, this library provides commonly
60 used attribute helper methods for more specific types of data.
62 As seen in the L</SYNOPSIS>, you specify the extension via the
63 C<metaclass> parameter. Available meta classes are:
67 =item L<Number|MooseX::AttributeHelpers::Number>
69 Common numerical operations.
71 =item L<Counter|MooseX::AttributeHelpers::Counter>
73 Methods for incrementing and decrementing a counter attribute.
75 =item L<Collection::Hash|MooseX::AttributeHelpers::Collection::Hash>
77 Common methods for hash references.
79 =item L<Collection::Array|MooseX::AttributeHelpers::Collection::Array>
81 Common methods for array references.
87 This is an early release of this module. Right now it is in great need
88 of documentation and tests in the test suite. However, we have used this
89 module to great success at $work where it has been tested very thoroughly
90 and deployed into a major production site.
92 I plan on getting better docs and tests in the next few releases, but until
93 then please refer to the few tests we do have and feel free email and/or
94 message me on irc.perl.org if you have any questions.
98 We need tests and docs badly.
102 All complex software has bugs lurking in it, and this module is no
103 exception. If you find a bug please either email me, or add the bug
108 Stevan Little E<lt>stevan@iinteractive.comE<gt>
110 B<with contributions from:>
114 Chris (perigrin) Prather
116 Robert (phaylon) Sedlacek
118 =head1 COPYRIGHT AND LICENSE
120 Copyright 2007 by Infinity Interactive, Inc.
122 L<http://www.iinteractive.com>
124 This library is free software; you can redistribute it and/or modify
125 it under the same terms as Perl itself.