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)
+ methods associated with, it will give a deprecation warning. (hdp)
0.83 Tue, Jun 23, 2009
* Moose::Meta::Class
|| @{ $self->associated_methods }
|| ($self->_is_metadata || '') eq 'bare'
) {
- $self->throw_error(
+ Carp::cluck(
'Attribute (' . $self->name . ') has no associated methods'
. ' (did you mean to provide an "is" argument?)'
+ . "\n"
)
}
return;
my $meta = Moose::Meta::Class->create_anon_class;
-#local $TODO = 'not implemented yet';
+my $warn;
+$SIG{__WARN__} = sub { $warn = "@_" };
-eval { $meta->add_attribute('foo') };
-like $@, qr/Attribute \(foo\) has no associated methods/,
+$meta->add_attribute('foo');
+like $warn, 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 $@;
+$warn = '';
+$meta->add_attribute('bar', is => 'bare');
+is $warn, '', 'add attribute with no methods and is => "bare"';