Bump to 0.12
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / MethodProvider / Bag.pm
1 package MooseX::AttributeHelpers::MethodProvider::Bag;
2 use Moose::Role;
3
4 our $VERSION   = '0.12';
5 our $AUTHORITY = 'cpan:STEVAN';
6
7 with 'MooseX::AttributeHelpers::MethodProvider::ImmutableHash';
8
9 sub add : method {
10     my ($attr, $reader, $writer) = @_;
11     return sub { $reader->($_[0])->{$_[1]}++ };
12 }
13
14 sub delete : method {
15     my ($attr, $reader, $writer) = @_;
16     return sub { CORE::delete $reader->($_[0])->{$_[1]} };
17 }
18
19 sub reset : method {
20     my ($attr, $reader, $writer) = @_;
21     return sub { $reader->($_[0])->{$_[1]} = 0 };
22 }
23
24 1;
25
26 __END__
27
28 =pod
29
30 =head1 NAME
31
32 MooseX::AttributeHelpers::MethodProvider::Bag
33
34 =head1 DESCRIPTION
35
36 This is a role which provides the method generators for
37 L<MooseX::AttributeHelpers::Collection::Bag>.
38
39 This role is composed from the 
40 L<MooseX::AttributeHelpers::Collection::ImmutableHash> role.
41
42 =head1 METHODS
43
44 =over 4
45
46 =item B<meta>
47
48 =back
49
50 =head1 PROVIDED METHODS
51
52 =over 4
53
54 =item B<count>
55
56 =item B<delete>
57
58 =item B<empty>
59
60 =item B<exists>
61
62 =item B<get>
63
64 =item B<keys>
65
66 =item B<add>
67
68 =item B<reset>
69
70 =item B<values>
71
72 =item B<kv>
73
74 =back
75
76 =head1 BUGS
77
78 All complex software has bugs lurking in it, and this module is no
79 exception. If you find a bug please either email me, or add the bug
80 to cpan-RT.
81
82 =head1 AUTHOR
83
84 Stevan Little E<lt>stevan@iinteractive.comE<gt>
85
86 =head1 COPYRIGHT AND LICENSE
87
88 Copyright 2007-2008 by Infinity Interactive, Inc.
89
90 L<http://www.iinteractive.com>
91
92 This library is free software; you can redistribute it and/or modify
93 it under the same terms as Perl itself.
94
95 =cut
96