Merge branch 'master' into traits
[gitmo/MooseX-AttributeHelpers.git] / lib / MooseX / AttributeHelpers / Counter.pm
index 7efbb51..9a2cea2 100644 (file)
@@ -2,44 +2,12 @@
 package MooseX::AttributeHelpers::Counter;
 use Moose;
 
-our $VERSION   = '0.03';
+our $VERSION   = '0.17';
+$VERSION = eval $VERSION;
 our $AUTHORITY = 'cpan:STEVAN';
 
-use MooseX::AttributeHelpers::MethodProvider::Counter;
-
-extends 'MooseX::AttributeHelpers::Base';
-
-has '+method_provider' => (
-    default => 'MooseX::AttributeHelpers::MethodProvider::Counter'
-);
-
-sub helper_type { 'Num' }
-
-before 'process_options_for_provides' => sub {
-    my ($self, $options, $name) = @_;
-
-    # Set some default attribute options here unless already defined
-    if ((my $type = $self->helper_type) && !exists $options->{isa}){
-        $options->{isa} = $type;
-    }
-    
-    $options->{is}      = 'ro' unless exists $options->{is};
-    $options->{default} = 0    unless exists $options->{default};
-};
-
-after 'check_provides_values' => sub {
-    my $self     = shift;
-    my $provides = $self->provides;
-
-    unless (scalar keys %$provides) {
-        my $method_constructors = $self->method_constructors;
-        my $attr_name           = $self->name;
-        
-        foreach my $method (keys %$method_constructors) {
-            $provides->{$method} = ($method . '_' . $attr_name);
-        }
-    }
-};
+extends 'Moose::Meta::Attribute';
+with 'MooseX::AttributeHelpers::Trait::Counter';
 
 no Moose;
 
@@ -128,7 +96,7 @@ Set the counter to the specified value.
 
 =item I<inc>
 
-Increments the value stored in this slot by 1.Providing an argument will
+Increments the value stored in this slot by 1. Providing an argument will
 cause the counter to be increased by specified amount.
 
 =item I<dec>