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