[Moose-commits] r7534 - in Moose/trunk: lib lib/Moose/Meta
lib/Moose/Meta/Method t/030_roles
autarch at code2.0beta.co.uk
autarch at code2.0beta.co.uk
Wed Feb 4 17:24:44 GMT 2009
Author: autarch
Date: 2009-02-04 09:24:44 -0800 (Wed, 04 Feb 2009)
New Revision: 7534
Added:
Moose/trunk/lib/Moose/Meta/Method/Overridden.pm
Removed:
Moose/trunk/lib/Moose/Meta/Method/Overriden.pm
Modified:
Moose/trunk/lib/Moose.pm
Moose/trunk/lib/Moose/Meta/Class.pm
Moose/trunk/lib/Moose/Meta/Method/Augmented.pm
Moose/trunk/t/030_roles/008_role_conflict_edge_cases.t
Log:
rename Overriden to Overridden
Modified: Moose/trunk/lib/Moose/Meta/Class.pm
===================================================================
--- Moose/trunk/lib/Moose/Meta/Class.pm 2009-02-04 14:28:17 UTC (rev 7533)
+++ Moose/trunk/lib/Moose/Meta/Class.pm 2009-02-04 17:24:44 UTC (rev 7534)
@@ -15,7 +15,7 @@
$VERSION = eval $VERSION;
our $AUTHORITY = 'cpan:STEVAN';
-use Moose::Meta::Method::Overriden;
+use Moose::Meta::Method::Overridden;
use Moose::Meta::Method::Augmented;
use Moose::Error::Default;
@@ -212,7 +212,7 @@
(!$self->has_method($name))
|| $self->throw_error("Cannot add an override method if a local method is already present");
- $self->add_method($name => Moose::Meta::Method::Overriden->new(
+ $self->add_method($name => Moose::Meta::Method::Overridden->new(
method => $method,
class => $self,
package => $_super_package, # need this for roles
@@ -238,7 +238,7 @@
my ($self, $name) = @_;
foreach my $method ($self->find_all_methods_by_name($name)) {
return $method->{code}
- if blessed($method->{code}) && !$method->{code}->isa('Moose::Meta::Method::Overriden');
+ if blessed($method->{code}) && !$method->{code}->isa('Moose::Meta::Method::Overridden');
}
return undef;
}
Modified: Moose/trunk/lib/Moose/Meta/Method/Augmented.pm
===================================================================
--- Moose/trunk/lib/Moose/Meta/Method/Augmented.pm 2009-02-04 14:28:17 UTC (rev 7533)
+++ Moose/trunk/lib/Moose/Meta/Method/Augmented.pm 2009-02-04 17:24:44 UTC (rev 7534)
@@ -26,7 +26,7 @@
my $_super_package = $super->package_name;
# BUT!,... if this is an overridden method ....
- if ($super->isa('Moose::Meta::Method::Overriden')) {
+ if ($super->isa('Moose::Meta::Method::Overridden')) {
# we need to be sure that we actually
# find the next method, which is not
# an 'override' method, the reason is
Copied: Moose/trunk/lib/Moose/Meta/Method/Overridden.pm (from rev 7530, Moose/trunk/lib/Moose/Meta/Method/Overriden.pm)
===================================================================
--- Moose/trunk/lib/Moose/Meta/Method/Overridden.pm (rev 0)
+++ Moose/trunk/lib/Moose/Meta/Method/Overridden.pm 2009-02-04 17:24:44 UTC (rev 7534)
@@ -0,0 +1,94 @@
+package Moose::Meta::Method::Overridden;
+
+use strict;
+use warnings;
+
+our $VERSION = '0.67';
+$VERSION = eval $VERSION;
+our $AUTHORITY = 'cpan:STEVAN';
+
+use base 'Moose::Meta::Method';
+
+sub new {
+ my ( $class, %args ) = @_;
+
+ # the package can be overridden by roles
+ # 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 $name = $args{name};
+
+ my $super = $args{class}->find_next_method_by_name($name);
+
+ (defined $super)
+ || $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;
+
+ # FIXME store additional attrs
+ $class->wrap(
+ $body,
+ package_name => $args{class}->name,
+ name => $name
+ );
+}
+
+1;
+
+__END__
+
+=pod
+
+=head1 NAME
+
+Moose::Meta::Method::Overridden - A Moose Method metaclass for overridden methods
+
+=head1 DESCRIPTION
+
+This class implements method overriding logic for the L<Moose> C<override> keyword.
+
+This involves setting up C<super> for the overriding body, and dispatching to
+the correct parent method upon its invocation.
+
+=head1 METHODS
+
+=over 4
+
+=item B<new>
+
+=back
+
+=head1 BUGS
+
+All complex software has bugs lurking in it, and this module is no
+exception. If you find a bug please either email me, or add the bug
+to cpan-RT.
+
+=head1 AUTHOR
+
+Yuval Kogman E<lt>nothingmuch at cpan.orgE<gt>
+
+=head1 COPYRIGHT AND LICENSE
+
+Copyright 2006-2009 by Infinity Interactive, Inc.
+
+L<http://www.iinteractive.com>
+
+This library is free software; you can redistribute it and/or modify
+it under the same terms as Perl itself.
+
+=cut
Deleted: Moose/trunk/lib/Moose/Meta/Method/Overriden.pm
===================================================================
--- Moose/trunk/lib/Moose/Meta/Method/Overriden.pm 2009-02-04 14:28:17 UTC (rev 7533)
+++ Moose/trunk/lib/Moose/Meta/Method/Overriden.pm 2009-02-04 17:24:44 UTC (rev 7534)
@@ -1,94 +0,0 @@
-package Moose::Meta::Method::Overriden;
-
-use strict;
-use warnings;
-
-our $VERSION = '0.67';
-$VERSION = eval $VERSION;
-our $AUTHORITY = 'cpan:STEVAN';
-
-use base 'Moose::Meta::Method';
-
-sub new {
- my ( $class, %args ) = @_;
-
- # the package can be overridden by roles
- # 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 $name = $args{name};
-
- my $super = $args{class}->find_next_method_by_name($name);
-
- (defined $super)
- || $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;
-
- # FIXME store additional attrs
- $class->wrap(
- $body,
- package_name => $args{class}->name,
- name => $name
- );
-}
-
-1;
-
-__END__
-
-=pod
-
-=head1 NAME
-
-Moose::Meta::Method::Overriden - A Moose Method metaclass for overridden methods
-
-=head1 DESCRIPTION
-
-This class implements method overriding logic for the L<Moose> C<override> keyword.
-
-This involves setting up C<super> for the overriding body, and dispatching to
-the correct parent method upon its invocation.
-
-=head1 METHODS
-
-=over 4
-
-=item B<new>
-
-=back
-
-=head1 BUGS
-
-All complex software has bugs lurking in it, and this module is no
-exception. If you find a bug please either email me, or add the bug
-to cpan-RT.
-
-=head1 AUTHOR
-
-Yuval Kogman E<lt>nothingmuch at cpan.orgE<gt>
-
-=head1 COPYRIGHT AND LICENSE
-
-Copyright 2006-2009 by Infinity Interactive, Inc.
-
-L<http://www.iinteractive.com>
-
-This library is free software; you can redistribute it and/or modify
-it under the same terms as Perl itself.
-
-=cut
Modified: Moose/trunk/lib/Moose.pm
===================================================================
--- Moose/trunk/lib/Moose.pm 2009-02-04 14:28:17 UTC (rev 7533)
+++ Moose/trunk/lib/Moose.pm 2009-02-04 17:24:44 UTC (rev 7534)
@@ -270,7 +270,7 @@
Moose::Meta::Method::Accessor
Moose::Meta::Method::Constructor
Moose::Meta::Method::Destructor
- Moose::Meta::Method::Overriden
+ Moose::Meta::Method::Overridden
Moose::Meta::Method::Augmented
Moose::Meta::Role
Modified: Moose/trunk/t/030_roles/008_role_conflict_edge_cases.t
===================================================================
--- Moose/trunk/t/030_roles/008_role_conflict_edge_cases.t 2009-02-04 14:28:17 UTC (rev 7533)
+++ Moose/trunk/t/030_roles/008_role_conflict_edge_cases.t 2009-02-04 17:24:44 UTC (rev 7534)
@@ -88,7 +88,7 @@
ok(Role::Derived3->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
ok(Role::Derived4->meta->has_override_method_modifier('foo'), '... have the method foo as expected');
ok(My::Test::Class2->meta->has_method('foo'), '... have the method foo as expected');
-isa_ok(My::Test::Class2->meta->get_method('foo'), 'Moose::Meta::Method::Overriden');
+isa_ok(My::Test::Class2->meta->get_method('foo'), 'Moose::Meta::Method::Overridden');
ok(My::Test::Class2::Base->meta->has_method('foo'), '... have the method foo as expected');
isa_ok(My::Test::Class2::Base->meta->get_method('foo'), 'Class::MOP::Method');
More information about the Moose-commits
mailing list