2 package MooseX::AttributeHelpers::Counter;
6 our $AUTHORITY = 'cpan:STEVAN';
8 use MooseX::AttributeHelpers::MethodProvider::Counter;
10 extends 'MooseX::AttributeHelpers::Base';
12 has '+method_provider' => (
13 default => 'MooseX::AttributeHelpers::MethodProvider::Counter'
16 sub helper_type { 'Num' }
20 # register the alias ...
21 package Moose::Meta::Attribute::Custom::Counter;
22 sub register_implementation { 'MooseX::AttributeHelpers::Counter' }
32 MooseX::AttributeHelpers::Counter
38 use MooseX::AttributeHelpers;
41 metaclass => 'Counter',
51 my $page = MyHomePage->new();
52 $page->inc_counter; # same as $page->counter($page->counter + 1);
53 $page->dec_counter; # same as $page->counter($page->counter - 1);
57 This module provides a simple counter attribute, which can be
58 incremented and decremeneted.
64 =item B<method_provider>
66 =item B<has_method_provider>
72 =head1 PROVIDED METHODS
74 It is important to note that all those methods do in place
75 modification of the value stored in the attribute.
81 Increments the value stored in this slot by 1.
85 Decrements the value stored in this slot by 1.
89 Resets the value stored in this slot to it's default value.
95 All complex software has bugs lurking in it, and this module is no
96 exception. If you find a bug please either email me, or add the bug
101 Stevan Little E<lt>stevan@iinteractive.comE<gt>
103 =head1 COPYRIGHT AND LICENSE
105 Copyright 2007 by Infinity Interactive, Inc.
107 L<http://www.iinteractive.com>
109 This library is free software; you can redistribute it and/or modify
110 it under the same terms as Perl itself.