From: Florian Ragwitz Date: Thu, 25 Mar 2010 17:13:43 +0000 (+0100) Subject: Stop Moose::Meta::Attribute::Native::Trait::Code from creating reader methods by... X-Git-Tag: 1.00~2 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=12885414d9faa397b0e4893483e211c8610c2660;p=gitmo%2FMoose.git Stop Moose::Meta::Attribute::Native::Trait::Code from creating reader methods by default. --- diff --git a/Changes b/Changes index 74d215f..aaed7f6 100644 --- a/Changes +++ b/Changes @@ -1,6 +1,10 @@ Also see Moose::Manual::Delta for more details of, and workarounds for, noteworthy changes. + [BUG FIXES] + * Moose::Meta::Attribute::Native::Trait::Code no longer creates reader + methods by default. (Florian Ragwitz) + 0.99 Mon, Mar 8, 2010 [NEW FEATURES] diff --git a/lib/Moose/Manual/Delta.pod b/lib/Moose/Manual/Delta.pod index 94f3e49..b9f747e 100644 --- a/lib/Moose/Manual/Delta.pod +++ b/lib/Moose/Manual/Delta.pod @@ -16,6 +16,18 @@ feature. If you encounter a problem and have a solution but don't see it documented here, or think we missed an important feature, please send us a patch. +=head1 1.00 + +=over 4 + +=item Moose::Meta::Attribute::Native::Trait::Code no longer creates reader methods by default + +Earlier versions of L created +read-only accessors for the attributes it's been applied to, even if you didn't +ask for it with C<< is => 'ro' >>. This incorrect behaviour has now been fixed. + +=back + =head1 0.95 =over 4 diff --git a/lib/Moose/Meta/Attribute/Native/Trait/Code.pm b/lib/Moose/Meta/Attribute/Native/Trait/Code.pm index b820128..fc45d8b 100644 --- a/lib/Moose/Meta/Attribute/Native/Trait/Code.pm +++ b/lib/Moose/Meta/Attribute/Native/Trait/Code.pm @@ -15,7 +15,6 @@ has method_provider => ( default => 'Moose::Meta::Attribute::Native::MethodProvider::Code', ); -sub _default_is { 'ro' } sub _helper_type { 'CodeRef' } no Moose::Role; diff --git a/t/070_native_traits/209_trait_code.t b/t/070_native_traits/209_trait_code.t index 5569902..8969d72 100644 --- a/t/070_native_traits/209_trait_code.t +++ b/t/070_native_traits/209_trait_code.t @@ -9,7 +9,6 @@ use Test::More; has callback => ( traits => ['Code'], - is => 'ro', isa => 'CodeRef', required => 1, handles => { 'invoke_callback' => 'execute' }, @@ -17,7 +16,6 @@ use Test::More; has callback_method => ( traits => ['Code'], - is => 'ro', isa => 'CodeRef', required => 1, handles => { 'invoke_method_callback' => 'execute_method' }, @@ -25,7 +23,6 @@ use Test::More; has multiplier => ( traits => ['Code'], - is => 'ro', isa => 'CodeRef', required => 1, handles => { 'multiply' => 'execute' }, @@ -45,4 +42,7 @@ is($i, 1); is($thingy->multiply(3), 6); is($thingy->invoke_method_callback(3), 6); +ok(!$thingy->can($_), "Code trait didn't create reader method for $_") + for qw(callback callback_method multiplier); + done_testing;