From: Hans Dieter Pearcey Date: Wed, 24 Jun 2009 20:17:07 +0000 (-0400) Subject: back out 'bare' attribute changes (moving to a branch) X-Git-Tag: 0.84~43 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9e70af8790a535f1653021f4ec3bf81a9c21e5cc;p=gitmo%2FMoose.git back out 'bare' attribute changes (moving to a branch) --- diff --git a/Changes b/Changes index 6a7d3cb..1d1f1df 100644 --- a/Changes +++ b/Changes @@ -1,11 +1,6 @@ Also see Moose::Manual::Delta for more details of, and workarounds for, noteworthy changes. -0.XX - * Moose::Meta::Attribute - - When adding an attribute to a metaclass, if the attribute has no - methods associated with, it will now throw an error. (hdp) - 0.83 Tue, Jun 23, 2009 * Moose::Meta::Class - Fix _construct_instance not setting the special __MOP__ object diff --git a/lib/Moose/Meta/Attribute.pm b/lib/Moose/Meta/Attribute.pm index beb546b..6d487aa 100644 --- a/lib/Moose/Meta/Attribute.pm +++ b/lib/Moose/Meta/Attribute.pm @@ -290,9 +290,6 @@ sub _process_options { $options->{accessor} ||= $name; } } - elsif ($options->{is} eq 'bare') { - # do nothing, but don't complain (later) about missing methods - } else { $class->throw_error("I do not understand this option (is => " . $options->{is} . ") on attribute ($name)", data => $options->{is}); } @@ -540,17 +537,6 @@ sub install_accessors { my $self = shift; $self->SUPER::install_accessors(@_); $self->install_delegation if $self->has_handles; - unless ( - # XXX handles should be in associated_methods - $self->has_handles - || @{ $self->associated_methods } - || ($self->_is_metadata || '') eq 'bare' - ) { - $self->throw_error( - 'Attribute (' . $self->name . ') has no associated methods' - . ' (did you mean to provide an "is" argument?)' - ) - } return; } diff --git a/t/020_attributes/007_attribute_custom_metaclass.t b/t/020_attributes/007_attribute_custom_metaclass.t index 25c3d1b..de3cb5b 100644 --- a/t/020_attributes/007_attribute_custom_metaclass.t +++ b/t/020_attributes/007_attribute_custom_metaclass.t @@ -76,7 +76,7 @@ use Test::Exception; } '... the attribute metaclass alias worked correctly'; ::lives_ok { - has 'bar' => (metaclass => 'Bar', is => 'bare'); + has 'bar' => (metaclass => 'Bar'); } '... the attribute metaclass alias worked correctly'; } diff --git a/t/020_attributes/009_attribute_inherited_slot_specs.t b/t/020_attributes/009_attribute_inherited_slot_specs.t index 7903f9d..46963b7 100644 --- a/t/020_attributes/009_attribute_inherited_slot_specs.t +++ b/t/020_attributes/009_attribute_inherited_slot_specs.t @@ -42,8 +42,8 @@ use Test::Exception; has 'one_last_one' => (is => 'rw', isa => 'Ref'); # this one will work here .... - has 'fail' => (isa => 'CodeRef', is => 'bare'); - has 'other_fail' => (is => 'bare'); + has 'fail' => (isa => 'CodeRef'); + has 'other_fail'; package Bar; use Moose; diff --git a/t/020_attributes/012_misc_attribute_tests.t b/t/020_attributes/012_misc_attribute_tests.t index b788d7c..8d02691 100644 --- a/t/020_attributes/012_misc_attribute_tests.t +++ b/t/020_attributes/012_misc_attribute_tests.t @@ -17,8 +17,7 @@ use Test::Exception; documentation => q{ The 'foo' attribute is my favorite attribute in the whole wide world. - }, - is => 'bare', + } ); } @@ -257,8 +256,8 @@ use Test::Exception; use Moose; } -lives_ok { OutOfClassTest::has('foo', is => 'bare'); } 'create attr via direct sub call'; -lives_ok { OutOfClassTest->can('has')->('bar', is => 'bare'); } 'create attr via can'; +lives_ok { OutOfClassTest::has('foo'); } 'create attr via direct sub call'; +lives_ok { OutOfClassTest->can('has')->('bar'); } 'create attr via can'; ok(OutOfClassTest->meta->get_attribute('foo'), 'attr created from sub call'); ok(OutOfClassTest->meta->get_attribute('bar'), 'attr created from can'); diff --git a/t/020_attributes/022_legal_options_for_inheritance.t b/t/020_attributes/022_legal_options_for_inheritance.t index c44b7d1..e30cc97 100644 --- a/t/020_attributes/022_legal_options_for_inheritance.t +++ b/t/020_attributes/022_legal_options_for_inheritance.t @@ -26,8 +26,7 @@ use Test::More tests => 2; has 'bar' => ( metaclass => 'Bar::Meta::Attribute', - my_legal_option => sub { 'Bar' }, - is => 'bare', + my_legal_option => sub { 'Bar' } ); package Bar::B; diff --git a/t/020_attributes/024_attribute_traits_parameterized.t b/t/020_attributes/024_attribute_traits_parameterized.t index 2561b34..c85f187 100644 --- a/t/020_attributes/024_attribute_traits_parameterized.t +++ b/t/020_attributes/024_attribute_traits_parameterized.t @@ -25,7 +25,6 @@ use Test::More tests => 4; }, }, ], - is => 'bare', ); } @@ -41,7 +40,6 @@ use Test::More tests => 4; }, }, ], - is => 'bare', ); } diff --git a/t/020_attributes/026_attribute_without_any_methods.t b/t/020_attributes/026_attribute_without_any_methods.t deleted file mode 100644 index c6f1348..0000000 --- a/t/020_attributes/026_attribute_without_any_methods.t +++ /dev/null @@ -1,22 +0,0 @@ -#!/usr/bin/perl - -use strict; -use warnings; - -use Test::More tests => 2; - -use Moose (); -use Moose::Meta::Class; - -my $meta = Moose::Meta::Class->create_anon_class; - -#local $TODO = 'not implemented yet'; - -eval { $meta->add_attribute('foo') }; -like $@, qr/Attribute \(foo\) has no associated methods/, - 'correct error message'; - -ok( - eval { $meta->add_attribute('bar', is => 'bare'); 1 }, - 'add attribute with no methods', -) or diag $@; diff --git a/t/030_roles/017_extending_role_attrs.t b/t/030_roles/017_extending_role_attrs.t index e960a67..df01d3d 100644 --- a/t/030_roles/017_extending_role_attrs.t +++ b/t/030_roles/017_extending_role_attrs.t @@ -151,7 +151,6 @@ is_deeply($quux->quux, ["hi"], "... still has the old ArrayRef value"); for (1..3) { has "err$_" => ( isa => 'Str | Int', - is => 'bare', ); } diff --git a/t/040_type_constraints/030_class_subtypes.t b/t/040_type_constraints/030_class_subtypes.t index 959b007..95ef25e 100644 --- a/t/040_type_constraints/030_class_subtypes.t +++ b/t/040_type_constraints/030_class_subtypes.t @@ -94,7 +94,6 @@ like $isa_foo->get_message( Baz->new ), qr/^Validation failed for 'IsaFoo' faile has age => ( isa => 'Positive', - is => 'bare', ); } @@ -128,7 +127,6 @@ class_type 'Negative' => message { "$_ is not a Negative Nancy" }; has age => ( isa => 'Negative', - is => 'bare', ); } diff --git a/t/050_metaclasses/014_goto_moose_import.t b/t/050_metaclasses/014_goto_moose_import.t index facf3e4..41056a9 100644 --- a/t/050_metaclasses/014_goto_moose_import.t +++ b/t/050_metaclasses/014_goto_moose_import.t @@ -31,7 +31,7 @@ use Test::Exception; MooseAlike1->import(); - ::lives_ok( sub { has( 'size', is => 'bare' ) }, + ::lives_ok( sub { has( 'size' ) }, 'has was exported via MooseAlike1' ); MooseAlike1->unimport(); @@ -68,7 +68,7 @@ isa_ok( Foo->meta(), 'Moose::Meta::Class' ); MooseAlike2->import(); - ::lives_ok( sub { has( 'size', is => 'bare' ) }, + ::lives_ok( sub { has( 'size' ) }, 'has was exported via MooseAlike2' ); MooseAlike2->unimport(); diff --git a/t/500_test_moose/003_test_moose_has_attribute_ok.t b/t/500_test_moose/003_test_moose_has_attribute_ok.t index 99e69f2..957ad33 100644 --- a/t/500_test_moose/003_test_moose_has_attribute_ok.t +++ b/t/500_test_moose/003_test_moose_has_attribute_ok.t @@ -14,7 +14,7 @@ BEGIN { package Foo; use Moose; - has 'foo', is => 'bare'; + has 'foo'; } { @@ -23,7 +23,7 @@ BEGIN { extends 'Foo'; - has 'bar', is => 'bare'; + has 'bar'; } diff --git a/xt/author/pod_coverage.t b/xt/author/pod_coverage.t index f5d36ff..3464180 100644 --- a/xt/author/pod_coverage.t +++ b/xt/author/pod_coverage.t @@ -15,12 +15,7 @@ plan tests => scalar @modules; my %trustme = ( 'Moose' => ['make_immutable'], - 'Moose::Meta::Attribute' => [ - qw( interpolate_class - throw_error - attach_to_class - ) - ], + 'Moose::Meta::Attribute' => [ 'interpolate_class', 'throw_error' ], 'Moose::Meta::Class' => [ qw( check_metaclass_compatibility construct_instance