1 package Moose::Meta::Method::Overriden;
9 our $AUTHORITY = 'cpan:STEVAN';
11 use base 'Moose::Meta::Method';
14 my ( $class, %args ) = @_;
16 # the package can be overridden by roles
17 # it is really more like body's compilation stash
18 # this is where we need to override the definition of super() so that the
19 # body of the code can call the right overridden version
20 my $_super_package = $args{package} || $args{class}->name;
22 my $name = $args{name};
24 my $super = $args{class}->find_next_method_by_name($name);
27 || confess "You cannot override '$name' because it has no super method";
29 my $super_body = $super->body;
31 my $method = $args{method};
34 local @Moose::SUPER_ARGS = @_;
35 local $Moose::SUPER_BODY = $super_body;
39 # FIXME do we need this make sure this works for next::method?
40 # subname "${_super_package}::${name}", $method;
42 # FIXME store additional attrs
45 package_name => $args{class}->name,
58 Moose::Meta::Method::Overriden - A Moose Method metaclass for overriden methods
62 This class implements method overriding logic for the L<Moose> C<override> keyword.
64 This involves setting up C<super> for the overriding body, and dispatching to
65 the correct parent method upon its invocation.
77 All complex software has bugs lurking in it, and this module is no
78 exception. If you find a bug please either email me, or add the bug
83 Yuval Kogman E<lt>nothingmuch@cpan.orgE<gt>
85 =head1 COPYRIGHT AND LICENSE
87 Copyright 2006-2008 by Infinity Interactive, Inc.
89 L<http://www.iinteractive.com>
91 This library is free software; you can redistribute it and/or modify
92 it under the same terms as Perl itself.