1 package MooseX::AttributeHelpers::MethodProvider::Counter;
2 use MooseX::AttributeHelpers::MethodProvider;
5 our $AUTHORITY = 'cpan:STEVAN';
7 add_method_provider 'Counter' => (
11 my ($attr, $reader, $writer) = @_;
12 return sub { $writer->($_[0], $attr->default($_[0])) };
16 my ($attr, $reader, $writer) = @_;
17 return sub { $writer->($_[0], $reader->($_[0]) + 1) };
21 my ($attr, $reader, $writer) = @_;
22 return sub { $writer->($_[0], $reader->($_[0]) - 1) };
35 MooseX::AttributeHelpers::MethodProvider::Counter
39 This is a role which provides the method generators for
40 L<MooseX::AttributeHelpers::Counter>.
42 =head1 PROVIDED METHODS
48 Increments the value stored in this slot by 1.
52 Decrements the value stored in this slot by 1.
56 Resets the value stored in this slot to its default value.
62 All complex software has bugs lurking in it, and this module is no
63 exception. If you find a bug please either email me, or add the bug
68 Stevan Little E<lt>stevan@iinteractive.comE<gt>
70 =head1 COPYRIGHT AND LICENSE
72 Copyright 2007-2008 by Infinity Interactive, Inc.
74 L<http://www.iinteractive.com>
76 This library is free software; you can redistribute it and/or modify
77 it under the same terms as Perl itself.