# attributes => qr//, #DWIM, treated as [qr//]
# attributes => [{...}] #DWIM, treat as [qr/./, {...} ]
# attributes => [[-exclude => ...]] #DWIM, treat as [qr/./, [-exclude => ...]]
- my $attr_haystack = [ map {$_->name} $object->meta->parameter_attributes ];
+ my $attr_haystack = [ map { $_->name } $object->meta->parameter_attributes ];
if(!defined $attr_rules){
$attr_rules = [qr/./];
} elsif( (!ref $attr_rules && $attr_rules) || (ref $attr_rules eq 'Regexp') ){
my $o_attr = $o_meta->find_attribute_by_name($attr_name);
my $s_attr_name = $o_attr->orig_attr_name || $attr_name;
my $s_attr = $s_meta->find_attribute_by_name($s_attr_name);
+ confess("Unable to find attribute for '${s_attr_name}' via '${source}'")
+ unless defined $s_attr;
next unless $s_attr->get_write_method; #only rw attributes!
my $attr_params = $self->parameters_for_source_object_action_attribute
use Reaction::ClassExporter;
use Reaction::Class;
use Moose::Meta::Class;
+
+use Sub::Name 'subname';
+use Scalar::Util qw/blessed reftype/;
+
#TODO: review for Reaction::Object switch / Reaction::Meta::Class
-*Moose::Meta::Role::add_method = sub {
- Moose::Meta::Class->can("add_method")->(@_);
-};
+#lifted from class MOP as a temp fix (groditi)
+*Moose::Meta::Role::add_method
+ = subname 'Moose::Meta::Role::add_method' => sub {
+ my ($self, $method_name, $code) = @_;
+ (defined $method_name && $method_name)
+ || confess "You must define a method name";
+
+ confess "Your code block must be a CODE reference"
+ unless 'CODE' eq reftype($code);
+
+ my $method = $self->method_metaclass->wrap($code);
+ $self->get_method_map->{$method_name} = $method;
+
+ my $full_name = ($self->name . '::' . $method_name);
+ $self->add_package_symbol("&${method_name}" => subname $full_name => $code);
+ };
+
class Role which {
$exports{role} = sub { $self->do_role_sub($package, @_); };
return %exports;
};
-
+
override next_import_package => sub { 'Moose::Role' };
-
+
override default_base => sub { () };
implements do_role_sub => as {
};
};
-
+
1;
=head1 NAME