-
package MooseX::AttributeHelpers::Counter;
use Moose;
-use MooseX::AttributeHelpers::Sugar;
+use MooseX::AttributeHelpers::MethodProvider::Counter;
extends 'MooseX::AttributeHelpers::Base';
our $VERSION = '0.03';
our $AUTHORITY = 'cpan:STEVAN';
-define_attribute_helper (
+__PACKAGE__->sugar(
default_options => {
is => 'ro',
default => 0,
},
- helper_type => 'Num',
- method_provider => 'MooseX::AttributeHelpers::MethodProvider::Counter',
auto_provide => 1,
+ method_provider => 'Counter',
shortcut => 'Counter',
);
no Moose;
-no MooseX::AttributeHelpers::Sugar;
1;
=head1 DESCRIPTION
-This module provides a simple counter attribute, which can be
-incremented and decremeneted.
+This module provides a simple counter attribute, which can be incremented and
+decremented. It is important to note that all those methods do in place
+modification of the value stored in the attribute.
If your attribute definition does not include any of I<is>, I<isa>,
I<default> or I<provides> but does use the C<Counter> metaclass,
has 'foo' => (metaclass => 'Counter');
$obj->inc_foo;
-=head1 METHODS
-
-=over 4
-
-=item B<meta>
-
=head1 PROVIDED METHODS
-It is important to note that all those methods do in place
-modification of the value stored in the attribute.
-
-=over 4
-
-=item I<inc>
-
-Increments the value stored in this slot by 1.
-
-=item I<dec>
-
-Decrements the value stored in this slot by 1.
-
-=item I<reset>
-
-Resets the value stored in this slot to it's default value.
-
-=back
+The methods for this metaclass are provided by
+L<MooseX::AttributeHelpers::MethodProvider::Counter>.
=head1 BUGS