1 package MooseX::AttributeHelpers::MethodProvider::Bag;
5 our $AUTHORITY = 'cpan:STEVAN';
7 with 'MooseX::AttributeHelpers::MethodProvider::ImmutableHash';
10 my ($attr, $reader, $writer) = @_;
11 return sub { $reader->($_[0])->{$_[1]}++ };
15 my ($attr, $reader, $writer) = @_;
16 return sub { CORE::delete $reader->($_[0])->{$_[1]} };
20 my ($attr, $reader, $writer) = @_;
21 return sub { $reader->($_[0])->{$_[1]} = 0 };
32 MooseX::AttributeHelpers::MethodProvider::Bag
36 This is a role which provides the method generators for
37 L<MooseX::AttributeHelpers::Collection::Bag>. It also consumes
38 L<MooseX::AttributeHelpers::Collection::ImmutableHash>, and thus provides all
39 of its methods asw well.
41 =head1 PROVIDED METHODS
47 Remove the supplied key from the bag.
51 Adds one to the value stored at the supplied key.
55 Sets the value at the supplied key to zero.
61 All complex software has bugs lurking in it, and this module is no
62 exception. If you find a bug please either email me, or add the bug
67 Stevan Little E<lt>stevan@iinteractive.comE<gt>
69 =head1 COPYRIGHT AND LICENSE
71 Copyright 2007-2008 by Infinity Interactive, Inc.
73 L<http://www.iinteractive.com>
75 This library is free software; you can redistribute it and/or modify
76 it under the same terms as Perl itself.