+ - fix coderef naming to avoid confusing autoclean
+
0.091002 - 2012-05-05
- exclude union roles and same-role-as-self from metaclass inflation
- inhale Moose roles before checking for composition conflicts
my $class = shift;
strictures->import;
return if $MAKERS{$target}; # already exported into this package
- _install_coderef "${target}::extends" => sub {
+ _install_coderef "${target}::extends" => "Moo::extends" => sub {
_load_module($_) for @_;
# Can't do *{...} = \@_ or 5.10.0's mro.pm stops seeing @ISA
@{*{_getglob("${target}::ISA")}{ARRAY}} = @_;
->register_attribute_specs(%{$old->all_attribute_specs});
}
};
- _install_coderef "${target}::with" => sub {
+ _install_coderef "${target}::with" => "Moo::with" => sub {
require Moo::Role;
Moo::Role->apply_roles_to_package($target, $_[0]);
};
$MAKERS{$target} = {};
- _install_coderef "${target}::has" => sub {
+ _install_coderef "${target}::has" => "Moo::has" => sub {
my ($name, %spec) = @_;
$class->_constructor_maker_for($target)
->register_attribute_specs($name, \%spec);
->generate_method($target, $name, \%spec);
};
foreach my $type (qw(before after around)) {
- _install_coderef "${target}::${type}" => sub {
+ _install_coderef "${target}::${type}" => "Moo::${type}" => sub {
require Class::Method::Modifiers;
_install_modifier($target, $type, @_);
};
return if $INFO{$target}; # already exported into this package
# get symbol table reference
my $stash = do { no strict 'refs'; \%{"${target}::"} };
- _install_coderef "${target}::has" => sub {
+ _install_coderef "${target}::has" => "Moo::Role::has" => sub {
my ($name, %spec) = @_;
($INFO{$target}{accessor_maker} ||= do {
require Method::Generate::Accessor;
{
package Foo;
use Moo::Role;
- use namespace::autoclean;
+ # if we autoclean here there's nothing left and then load_class tries
+ # to require Foo during Moose application and everything breaks.
}
{
package Bar;
::is(Baz->can('thing'), Bar->can('thing'), 'Role copies method correctly');
::ok(Baz->can('attr'), 'Attr accessor correct');
+::ok(!Bar->can('has'), 'Moo::Role sugar removed by autoclean');
+::ok(!Bar->can('with'), 'Role::Tiny sugar removed by autoclean');
::ok(!Baz->can('has'), 'Sugar not copied');
{