X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FMethod%2FOverriden.pm;h=2dcda183a79e4f62e71922d0fe67188199cf58d5;hb=aa7bbf26111ba4ed260458857f0a9cf007511bd4;hp=344f804e8a34b7b575a9105b55ac3345b1116c88;hpb=1b2aea393ea1e336731ca6831f57e17615f769d9;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Method/Overriden.pm b/lib/Moose/Meta/Method/Overriden.pm index 344f804..2dcda18 100644 --- a/lib/Moose/Meta/Method/Overriden.pm +++ b/lib/Moose/Meta/Method/Overriden.pm @@ -3,9 +3,8 @@ package Moose::Meta::Method::Overriden; use strict; use warnings; -use Carp 'confess'; - -our $VERSION = '0.02'; +our $VERSION = '0.66'; +$VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; use base 'Moose::Meta::Method'; @@ -17,27 +16,28 @@ sub new { # it is really more like body's compilation stash # this is where we need to override the definition of super() so that the # body of the code can call the right overridden version - my $_super_package = $args{package} || $args{class}->name; + my $super_package = $args{package} || $args{class}->name; my $name = $args{name}; my $super = $args{class}->find_next_method_by_name($name); (defined $super) - || confess "You cannot override '$name' because it has no super method"; + || $class->throw_error("You cannot override '$name' because it has no super method", data => $name); my $super_body = $super->body; my $method = $args{method}; my $body = sub { + local $Moose::SUPER_PACKAGE = $super_package; 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; + # subname "${super_package}::${name}", $method; # FIXME store additional attrs $class->wrap( @@ -84,7 +84,7 @@ Yuval Kogman Enothingmuch@cpan.orgE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2009 by Infinity Interactive, Inc. L