Revision history for Perl extension Moose
+0.24
+ * Moose::Meta::Role
+ - required methods are now fetched using find_method_by_name
+ so that required methods can come from superclasses
+ - adjusted tests for this
+
0.23 Mon. June 18, 2007
* Moose::Meta::Method::Constructor
- fix inlined constructor for hierarchy with multiple BUILD methods (mst)
use strict;
use warnings;
-our $VERSION = '0.23';
+our $VERSION = '0.24';
our $AUTHORITY = 'cpan:STEVAN';
use Scalar::Util 'blessed', 'reftype';
use Scalar::Util 'blessed';
use B 'svref_2object';
-our $VERSION = '0.07';
+our $VERSION = '0.08';
our $AUTHORITY = 'cpan:STEVAN';
use Moose::Meta::Class;
} (shift)->Moose::Meta::Class::get_method_list(@_)
}
-sub find_method_by_name { (shift)->has_method(@_) }
+sub find_method_by_name { (shift)->get_method(@_) }
# ... however the items in statis (attributes & method modifiers)
# can be removed and added to through this API
# we need to make sure that the method is
# not a method modifier, because those do
# not satisfy the requirements ...
- my $method = $other->get_method($required_method_name);
+ my $method = $other->find_method_by_name($required_method_name);
# check if it is an override or a generated accessor ..
(!$method->isa('Moose::Meta::Method::Overriden') &&
!$method->isa('Class::MOP::Method::Accessor'))
use Test::More tests => 18;
use Test::Exception;
+=pod
+
+NOTE:
+A fair amount of these tests will likely be irrelevant
+once we have more fine grained control over the class
+building process. A lot of the edge cases tested here
+are actually related to class construction order and
+not any real functionality.
+- SL
+
+=cut
+
BEGIN {
use_ok('Moose');
use_ok('Moose::Role');
extends 'Class::ProvideFoo::Base';
- ::dies_ok {
+ ::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will not exist yet (and we will die)';
+ } '... the required "foo" method will be found in the superclass';
override 'foo' => sub { 'Class::ProvideFoo::foo' };
extends 'Class::ProvideFoo::Base';
- ::dies_ok {
+ ::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will not exist yet (and we will die)';
+ } '... the required "foo" method will be found in the superclass';
before 'foo' => sub { 'Class::ProvideFoo::foo:before' };
extends 'Class::ProvideFoo::Base';
- ::dies_ok {
+ ::lives_ok {
with 'Role::RequireFoo';
- } '... the required "foo" method will not exist yet (and we will die)';
+ } '... the required "foo" method will be found in the superclass (but then overriden)';
has 'foo' => (is => 'ro');