diff options
author | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-01-25 04:17:58 +0000 |
---|---|---|
committer | matthewt <matthewt@03d0b0b2-0e1a-0410-a411-fdb2f4bd65d7> | 2008-01-25 04:17:58 +0000 |
commit | fd86f68125ddf7cd521943242a0505c12826ae79 (patch) | |
tree | 572a9ae92ce530d14b787635d7939f51bc45c954 | |
parent | 32afff5dca9e4e124f35b72c05a44a7ca4c1399d (diff) | |
download | reaction-fd86f68125ddf7cd521943242a0505c12826ae79.tar.gz reaction-fd86f68125ddf7cd521943242a0505c12826ae79.zip |
revert #515, completely the wrong solution and blows the diff for the right one
-rw-r--r-- | lib/Reaction/Role.pm | 30 |
1 files changed, 6 insertions, 24 deletions
diff --git a/lib/Reaction/Role.pm b/lib/Reaction/Role.pm index 13815db..ea5b948 100644 --- a/lib/Reaction/Role.pm +++ b/lib/Reaction/Role.pm @@ -4,28 +4,10 @@ use Moose::Role (); 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 -#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); - }; - +*Moose::Meta::Role::add_method = sub { + Moose::Meta::Class->can("add_method")->(@_); +}; class Role which { @@ -36,9 +18,9 @@ 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 { @@ -49,7 +31,7 @@ class Role which { }; }; - + 1; =head1 NAME |