Bump to 0.13
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / MethodProvider / Bag.pm
CommitLineData
9a976497 1package MooseX::AttributeHelpers::MethodProvider::Bag;
2use Moose::Role;
3
18d43c2c 4our $VERSION = '0.13';
9a976497 5our $AUTHORITY = 'cpan:STEVAN';
6
7with 'MooseX::AttributeHelpers::MethodProvider::ImmutableHash';
8
9sub add : method {
10 my ($attr, $reader, $writer) = @_;
11 return sub { $reader->($_[0])->{$_[1]}++ };
12}
13
14sub delete : method {
15 my ($attr, $reader, $writer) = @_;
16 return sub { CORE::delete $reader->($_[0])->{$_[1]} };
17}
18
19sub reset : method {
20 my ($attr, $reader, $writer) = @_;
21 return sub { $reader->($_[0])->{$_[1]} = 0 };
22}
23
241;
25
26__END__
27
28=pod
29
30=head1 NAME
31
32MooseX::AttributeHelpers::MethodProvider::Bag
33
34=head1 DESCRIPTION
35
36This is a role which provides the method generators for
37L<MooseX::AttributeHelpers::Collection::Bag>.
38
39This role is composed from the
40L<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
78All complex software has bugs lurking in it, and this module is no
79exception. If you find a bug please either email me, or add the bug
80to cpan-RT.
81
82=head1 AUTHOR
83
84Stevan Little E<lt>stevan@iinteractive.comE<gt>
85
86=head1 COPYRIGHT AND LICENSE
87
99c62fb8 88Copyright 2007-2008 by Infinity Interactive, Inc.
9a976497 89
90L<http://www.iinteractive.com>
91
92This library is free software; you can redistribute it and/or modify
93it under the same terms as Perl itself.
94
95=cut
96