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
30 metaclass => 'Collection::Hash',
33 default => sub { {} },
35 exists => 'exists_in_mapping',
36 keys => 'ids_in_mapping',
44 my $obj = MyClass->new;
45 $obj->set_mapping(4, 'foo');
46 $obj->set_mapping(5, 'bar');
47 $obj->set_mapping(6, 'baz');
50 print $obj->get_mapping(5) if $obj->exists_in_mapping(5);
53 print join ', ', $obj->ids_in_mapping;
57 While L<Moose> attributes provide you with a way to name your accessors,
58 readers, writers, clearers and predicates, this library provides commonly
59 used attribute helper methods for more specific types of data.
61 As seen in the L</SYNOPSIS>, you specify the extension via the
62 C<metaclass> parameter. Available meta classes are:
66 =item L<Number|MooseX::AttributeHelpers::Number>
68 Common numerical operations.
70 =item L<Counter|MooseX::AttributeHelpers::Counter>
72 Methods for incrementing and decrementing a counter attribute.
74 =item L<Collection::Hash|MooseX::AttributeHelpers::Collection::Hash>
76 Common methods for hash references.
78 =item L<Collection::Array|MooseX::AttributeHelpers::Collection::Array>
80 Common methods for array references.
86 All complex software has bugs lurking in it, and this module is no
87 exception. If you find a bug please either email me, or add the bug
92 Stevan Little E<lt>stevan@iinteractive.comE<gt>
94 =head1 COPYRIGHT AND LICENSE
96 Copyright 2007 by Infinity Interactive, Inc.
98 L<http://www.iinteractive.com>
100 This library is free software; you can redistribute it and/or modify
101 it under the same terms as Perl itself.