0.49
[gitmo/Moose.git] / lib / Moose / Meta / Method / Overriden.pm
index ef831dd..344f804 100644 (file)
@@ -3,13 +3,13 @@ package Moose::Meta::Method::Overriden;
 use strict;
 use warnings;
 
-our $VERSION   = '0.01';
+use Carp 'confess';
+
+our $VERSION   = '0.02';
 our $AUTHORITY = 'cpan:STEVAN';
 
 use base 'Moose::Meta::Method';
 
-use Carp qw(confess);
-
 sub new {
     my ( $class, %args ) = @_;
 
@@ -28,22 +28,23 @@ sub new {
 
     my $super_body = $super->body;
 
-    my $method = $args{override};
+    my $method = $args{method};
 
     my $body = sub {
-        my @args = @_;
-        if ($Moose::SUPER_SLOT{$_super_package}) {
-            no warnings 'redefine';
-            # FIXME goto() to prevent additional stack frame?
-            local *{$Moose::SUPER_SLOT{$_super_package}} = sub { $super_body->(@args) };
-            return $method->(@args);
-        } else {
-            confess "Trying to call override modifier'd method without super()";
-        }
+        local @Moose::SUPER_ARGS = @_;
+        local $Moose::SUPER_BODY = $super_body;
+        return $method->(@_);
     };
 
+    # FIXME do we need this make sure this works for next::method?
+    # subname "${_super_package}::${name}", $method;
+
     # FIXME store additional attrs
-    $class->wrap($body);
+    $class->wrap(
+        $body,
+        package_name => $args{class}->name,
+        name         => $name
+    );
 }
 
 1;
@@ -79,7 +80,7 @@ to cpan-RT.
 
 =head1 AUTHOR
 
-Stevan Little E<lt>stevan@iinteractive.comE<gt>
+Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt>
 
 =head1 COPYRIGHT AND LICENSE