eval "package ${package}; no $unimport_class;";
confess "$unimport_class unimport from ${package} failed: $@" if $@;
foreach my $m (@methods) {
- $package->meta->add_method(@$m);
+ $self->add_method_to_target($package, $m);
}
foreach my $a (@apply_after) {
my $call = shift(@$a);
}
}
+sub add_method_to_target {
+ my ($self, $target, $method) = @_;
+ $target->meta->add_method(@$method);
+}
+
sub delayed_methods {
return (qw/has with extends before after around override augment/);
}
use Reaction::ClassExporter;
use Reaction::Class;
use Moose::Meta::Class;
+
#TODO: review for Reaction::Object switch / Reaction::Meta::Class
-*Moose::Meta::Role::add_method = sub {
- Moose::Meta::Class->can("add_method")->(@_);
-};
class Role which {
$exports{role} = sub { $self->do_role_sub($package, @_); };
return %exports;
};
-
+
override next_import_package => sub { 'Moose::Role' };
-
+
override default_base => sub { () };
+ override add_method_to_target => sub {
+ my ($self, $target, $method) = @_;
+ $target->meta->alias_method(@$method);
+ };
+
implements do_role_sub => as {
my ($self, $package, $role, $which, $setup) = @_;
confess "Invalid role declaration, should be: role Role which { ... }"
};
};
-
+
1;
=head1 NAME