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
$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});
}
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;
}
} '... the attribute metaclass alias worked correctly';
::lives_ok {
- has 'bar' => (metaclass => 'Bar', is => 'bare');
+ has 'bar' => (metaclass => 'Bar');
} '... the attribute metaclass alias worked correctly';
}
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;
documentation => q{
The 'foo' attribute is my favorite
attribute in the whole wide world.
- },
- is => 'bare',
+ }
);
}
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');
has 'bar' => (
metaclass => 'Bar::Meta::Attribute',
- my_legal_option => sub { 'Bar' },
- is => 'bare',
+ my_legal_option => sub { 'Bar' }
);
package Bar::B;
},
},
],
- is => 'bare',
);
}
},
},
],
- is => 'bare',
);
}
+++ /dev/null
-#!/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 $@;
for (1..3) {
has "err$_" => (
isa => 'Str | Int',
- is => 'bare',
);
}
has age => (
isa => 'Positive',
- is => 'bare',
);
}
has age => (
isa => 'Negative',
- is => 'bare',
);
}
MooseAlike1->import();
- ::lives_ok( sub { has( 'size', is => 'bare' ) },
+ ::lives_ok( sub { has( 'size' ) },
'has was exported via MooseAlike1' );
MooseAlike1->unimport();
MooseAlike2->import();
- ::lives_ok( sub { has( 'size', is => 'bare' ) },
+ ::lives_ok( sub { has( 'size' ) },
'has was exported via MooseAlike2' );
MooseAlike2->unimport();
package Foo;
use Moose;
- has 'foo', is => 'bare';
+ has 'foo';
}
{
extends 'Foo';
- has 'bar', is => 'bare';
+ has 'bar';
}
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