From: Dave Rolsky Date: Fri, 26 Jun 2009 21:56:06 +0000 (-0500) Subject: renamed helper_type => _helper_type X-Git-Tag: 0.89_02~104 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=2e069f5a4946bae92ec4eedc39c774e5c6ef3051;p=gitmo%2FMoose.git renamed helper_type => _helper_type --- diff --git a/lib/Moose/AttributeHelpers/Trait/Base.pm b/lib/Moose/AttributeHelpers/Trait/Base.pm index b32c4dd..caace47 100644 --- a/lib/Moose/AttributeHelpers/Trait/Base.pm +++ b/lib/Moose/AttributeHelpers/Trait/Base.pm @@ -7,7 +7,7 @@ our $VERSION = '0.85'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; -requires 'helper_type'; +requires '_helper_type'; # these next two are the possible methods # you can use in the 'handles' map. @@ -59,9 +59,9 @@ before '_process_options' => sub { sub _check_helper_type { my ( $self, $options, $name ) = @_; - my $type = $self->helper_type; + my $type = $self->_helper_type; - $options->{isa} = $self->helper_type + $options->{isa} = $type unless exists $options->{isa}; my $isa = Moose::Util::TypeConstraints::find_or_create_type_constraint( diff --git a/lib/Moose/AttributeHelpers/Trait/Bool.pm b/lib/Moose/AttributeHelpers/Trait/Bool.pm index c4e4223..17d0f74 100644 --- a/lib/Moose/AttributeHelpers/Trait/Bool.pm +++ b/lib/Moose/AttributeHelpers/Trait/Bool.pm @@ -8,9 +8,8 @@ our $AUTHORITY = 'cpan:STEVAN'; with 'Moose::AttributeHelpers::Trait::Base'; -sub helper_type { 'Bool' } - sub _default_is { 'rw' } +sub _helper_type { 'Bool' } # NOTE: # we don't use the method provider for this @@ -76,8 +75,6 @@ basic math operations. =item B -=item B - =item B =item B diff --git a/lib/Moose/AttributeHelpers/Trait/Collection/Array.pm b/lib/Moose/AttributeHelpers/Trait/Collection/Array.pm index b74ed6d..6dbd305 100644 --- a/lib/Moose/AttributeHelpers/Trait/Collection/Array.pm +++ b/lib/Moose/AttributeHelpers/Trait/Collection/Array.pm @@ -17,7 +17,7 @@ has 'method_provider' => ( default => 'Moose::AttributeHelpers::MethodProvider::Array' ); -sub helper_type { 'ArrayRef' } +sub _helper_type { 'ArrayRef' } no Moose::Role; @@ -72,8 +72,6 @@ for more details. =item B -=item B - =back =head1 BUGS diff --git a/lib/Moose/AttributeHelpers/Trait/Collection/Bag.pm b/lib/Moose/AttributeHelpers/Trait/Collection/Bag.pm index 3f96d08..d6adc43 100644 --- a/lib/Moose/AttributeHelpers/Trait/Collection/Bag.pm +++ b/lib/Moose/AttributeHelpers/Trait/Collection/Bag.pm @@ -20,7 +20,7 @@ has 'method_provider' => ( subtype 'Bag' => as 'HashRef[Int]'; -sub helper_type { 'Bag' } +sub _helper_type { 'Bag' } sub _default_default { sub { {} } } @@ -79,10 +79,6 @@ for more details. =item B -=item B - -=item B - =back =head1 BUGS diff --git a/lib/Moose/AttributeHelpers/Trait/Collection/Hash.pm b/lib/Moose/AttributeHelpers/Trait/Collection/Hash.pm index bf1cb39..3928523 100644 --- a/lib/Moose/AttributeHelpers/Trait/Collection/Hash.pm +++ b/lib/Moose/AttributeHelpers/Trait/Collection/Hash.pm @@ -17,7 +17,7 @@ has 'method_provider' => ( default => 'Moose::AttributeHelpers::MethodProvider::Hash' ); -sub helper_type { 'HashRef' } +sub _helper_type { 'HashRef' } no Moose::Role; @@ -75,8 +75,6 @@ for more details. =item B -=item B - =back =head1 BUGS diff --git a/lib/Moose/AttributeHelpers/Trait/Collection/ImmutableHash.pm b/lib/Moose/AttributeHelpers/Trait/Collection/ImmutableHash.pm index fdddd3e..62c952e 100644 --- a/lib/Moose/AttributeHelpers/Trait/Collection/ImmutableHash.pm +++ b/lib/Moose/AttributeHelpers/Trait/Collection/ImmutableHash.pm @@ -17,7 +17,7 @@ has 'method_provider' => ( default => 'Moose::AttributeHelpers::MethodProvider::ImmutableHash' ); -sub helper_type { 'HashRef' } +sub _helper_type { 'HashRef' } no Moose::Role; @@ -73,8 +73,6 @@ for more details. =item B -=item B - =back =head1 BUGS diff --git a/lib/Moose/AttributeHelpers/Trait/Collection/List.pm b/lib/Moose/AttributeHelpers/Trait/Collection/List.pm index 3081ee7..780794c 100644 --- a/lib/Moose/AttributeHelpers/Trait/Collection/List.pm +++ b/lib/Moose/AttributeHelpers/Trait/Collection/List.pm @@ -17,7 +17,7 @@ has 'method_provider' => ( default => 'Moose::AttributeHelpers::MethodProvider::List' ); -sub helper_type { 'ArrayRef' } +sub _helper_type { 'ArrayRef' } no Moose::Role; @@ -72,8 +72,6 @@ for more details. =item B -=item B - =back =head1 BUGS diff --git a/lib/Moose/AttributeHelpers/Trait/Counter.pm b/lib/Moose/AttributeHelpers/Trait/Counter.pm index 71965c4..6244a8a 100644 --- a/lib/Moose/AttributeHelpers/Trait/Counter.pm +++ b/lib/Moose/AttributeHelpers/Trait/Counter.pm @@ -19,8 +19,7 @@ has 'method_provider' => ( sub _default_default { 0 } sub _default_is { 'ro' } - -sub helper_type { 'Num' } +sub _helper_type { 'Num' } after '_check_handles_values' => sub { my $self = shift; @@ -100,8 +99,6 @@ above. This allows for a very basic counter definition: =item B -=item B - =back =head1 PROVIDED METHODS diff --git a/lib/Moose/AttributeHelpers/Trait/Number.pm b/lib/Moose/AttributeHelpers/Trait/Number.pm index 178d275..7636655 100644 --- a/lib/Moose/AttributeHelpers/Trait/Number.pm +++ b/lib/Moose/AttributeHelpers/Trait/Number.pm @@ -7,7 +7,7 @@ our $AUTHORITY = 'cpan:STEVAN'; with 'Moose::AttributeHelpers::Trait::Base'; -sub helper_type { 'Num' } +sub _helper_type { 'Num' } # NOTE: # we don't use the method provider for this @@ -105,8 +105,6 @@ basic math operations. =item B -=item B - =item B =back diff --git a/lib/Moose/AttributeHelpers/Trait/String.pm b/lib/Moose/AttributeHelpers/Trait/String.pm index 54c9658..e3e4564 100644 --- a/lib/Moose/AttributeHelpers/Trait/String.pm +++ b/lib/Moose/AttributeHelpers/Trait/String.pm @@ -17,10 +17,9 @@ has 'method_provider' => ( default => 'Moose::AttributeHelpers::MethodProvider::String', ); -sub helper_type { 'Str' } - sub _default_default { q{} } sub _default_is { 'rw' } +sub _helper_type { 'Str' } after '_check_handles_values' => sub { my $self = shift; @@ -98,16 +97,6 @@ above. This allows for a very basic counter definition: =item B -=item B - -=item B - -Run before its superclass method. - -=item B - -Run after its superclass method. - =back =head1 PROVIDED METHODS diff --git a/t/070_attribute_helpers/011_counter_with_defaults.t b/t/070_attribute_helpers/011_counter_with_defaults.t index 09fc69a..f52ecb2 100644 --- a/t/070_attribute_helpers/011_counter_with_defaults.t +++ b/t/070_attribute_helpers/011_counter_with_defaults.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 14; +use Test::More tests => 13; use Test::Moose; BEGIN { @@ -45,8 +45,6 @@ is($page->counter, 0, '... got the original value'); my $counter = $page->meta->get_attribute('counter'); does_ok($counter, 'Moose::AttributeHelpers::Trait::Counter'); -is($counter->helper_type, 'Num', '... got the expected helper type'); - is($counter->type_constraint->name, 'Num', '... got the expected default type constraint'); is_deeply($counter->handles, { diff --git a/t/070_attribute_helpers/201_trait_counter.t b/t/070_attribute_helpers/201_trait_counter.t index 0fa544f..d321b61 100644 --- a/t/070_attribute_helpers/201_trait_counter.t +++ b/t/070_attribute_helpers/201_trait_counter.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 18; +use Test::More tests => 17; use Test::Moose 'does_ok'; BEGIN { @@ -66,8 +66,6 @@ is($page->counter, 2, '... decrement by arg'); my $counter = $page->meta->get_attribute('counter'); does_ok($counter, 'Moose::AttributeHelpers::Trait::Counter'); -is($counter->helper_type, 'Num', '... got the expected helper type'); - is($counter->type_constraint->name, 'Int', '... got the expected type constraint'); is_deeply($counter->handles, { diff --git a/t/070_attribute_helpers/207_trait_string.t b/t/070_attribute_helpers/207_trait_string.t index 69646dc..d0646b2 100644 --- a/t/070_attribute_helpers/207_trait_string.t +++ b/t/070_attribute_helpers/207_trait_string.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 21; +use Test::More tests => 20; use Test::Moose 'does_ok'; BEGIN { @@ -90,8 +90,6 @@ is($page->string, '', "clear"); my $string = $page->meta->get_attribute('string'); does_ok($string, 'Moose::AttributeHelpers::Trait::String'); -is($string->helper_type, 'Str', '... got the expected helper type'); - is($string->type_constraint->name, 'Str', '... got the expected type constraint'); is_deeply($string->handles, {