From: Stevan Little Date: Thu, 4 May 2006 15:23:12 +0000 (+0000) Subject: fooooooooooooo X-Git-Tag: 0_09_03~42 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=687e52bbbeea9c3096697e66aa88c2f022ed7478;p=gitmo%2FMoose.git fooooooooooooo --- diff --git a/TODO b/TODO index 50dc044..e5bc34f 100644 --- a/TODO +++ b/TODO @@ -39,10 +39,6 @@ more metadata. like an attribute,.. but if you look behind the curtain,.. its over there.. in that other object - -- moosedoc - -We certainly have enough meta-information to make pretty complete POD docs. - compile time extends @@ -62,9 +58,10 @@ nothingmuch notes that all the constructs should be supported in the entirety of and that if this usage style is used nothing is exported to the namespace. - - default should dclone() +- auto_deref => 1 for auto-de-refing ARRAY and HASH attrs + ------------------------------------------------------------------------------- TO PONDER ------------------------------------------------------------------------------- @@ -78,7 +75,9 @@ which can be turned off in prod. To explain Moose from a very high level +- moosedoc +We certainly have enough meta-information to make pretty complete POD docs. diff --git a/lib/Moose.pm b/lib/Moose.pm index 707a2fe..9b31e5c 100644 --- a/lib/Moose.pm +++ b/lib/Moose.pm @@ -1,6 +1,4 @@ -use lib '/Users/stevan/Projects/CPAN/Class-MOP/Class-MOP/lib'; - package Moose; use strict; @@ -82,13 +80,20 @@ use Moose::Util::TypeConstraints; # but if we have anything else, # we need to check it out ... unless (# see if of our metaclass is incompatible - $meta->isa(blessed($super->meta)) && - # see if our instance metaclass is incompatible - $meta->instance_metaclass->isa($super->meta->instance_metaclass) && + ($meta->isa(blessed($super->meta)) && + # and see if our instance metaclass is incompatible + $meta->instance_metaclass->isa($super->meta->instance_metaclass)) && # ... and if we are just a vanilla Moose $meta->isa('Moose::Meta::Class')) { # re-initialize the meta ... my $super_meta = $super->meta; + # NOTE: + # We might want to consider actually + # transfering any attributes from the + # original meta into this one, but in + # general you should not have any there + # at this point anyway, so it's very + # much an obscure edge case anyway $meta = $super_meta->reinitialize($class => ( ':attribute_metaclass' => $super_meta->attribute_metaclass, ':method_metaclass' => $super_meta->method_metaclass, @@ -104,6 +109,8 @@ use Moose::Util::TypeConstraints; return subname 'Moose::with' => sub { my ($role) = @_; _load_all_classes($role); + ($role->can('meta') && $role->meta->isa('Moose::Meta::Role')) + || confess "You can only consume roles, $role is not a Moose role"; $role->meta->apply($class->meta); }; }, diff --git a/t/043_role_composition_errors.t b/t/043_role_composition_errors.t index b9e78d7..5e182f0 100644 --- a/t/043_role_composition_errors.t +++ b/t/043_role_composition_errors.t @@ -3,7 +3,7 @@ use strict; use warnings; -use Test::More tests => 10; +use Test::More tests => 11; use Test::Exception; BEGIN { @@ -41,7 +41,8 @@ is_deeply( use warnings; use Moose; - ::lives_ok { with('Foo::Role') } '... has a foo method implemented by Bar::Class'; + ::dies_ok { with('Foo::Class') } '... cannot consume a class, it must be a role'; + ::lives_ok { with('Foo::Role') } '... has a foo method implemented by Bar::Class'; sub foo { 'Bar::Class::foo' } }