X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?p=gitmo%2FMouse.git;a=blobdiff_plain;f=lib%2FMouse.pm;h=68808b8ed1f68ae757ed0c2e96ab0fde64ddcb1e;hp=4bf8ab3453e4798b49b017f63804efde81b0f3d0;hb=85bd3f44fbee036b39fedb1e2ca2b566c1a6d08f;hpb=98ab51333533a85f044f893160daaf525fb6da2c diff --git a/lib/Mouse.pm b/lib/Mouse.pm index 4bf8ab3..68808b8 100644 --- a/lib/Mouse.pm +++ b/lib/Mouse.pm @@ -86,27 +86,14 @@ our @SUPER_ARGS; sub super { # This check avoids a recursion loop - see # t/100_bugs/020_super_recursion.t - return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); - return unless $SUPER_BODY; $SUPER_BODY->(@SUPER_ARGS); + return if defined $SUPER_PACKAGE && $SUPER_PACKAGE ne caller(); + return if !defined $SUPER_BODY; + $SUPER_BODY->(@SUPER_ARGS); } sub override { - my $meta = Mouse::Meta::Class->initialize(caller); - my $pkg = $meta->name; - - my $name = shift; - my $code = shift; - - my $body = $pkg->can($name) - or confess "You cannot override '$name' because it has no super method"; - - $meta->add_method($name => sub { - local $SUPER_PACKAGE = $pkg; - local @SUPER_ARGS = @_; - local $SUPER_BODY = $body; - - $code->(@_); - }); + # my($name, $method) = @_; + Mouse::Meta::Class->initialize(scalar caller)->add_override_method_modifier(@_); } sub inner { not_supported }