X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMoose%2FMeta%2FRole%2FApplication%2FToInstance.pm;h=f44c0241eb30b1c8438b596c7cf922843f77f8b5;hb=d4048ef33f6cad8a3453766505ee0c67690796f6;hp=1d6ff7cdd6e113bd39fbffba295509d7bea912eb;hpb=e1737edc1aeb23724d9da1fec93ed82e900d8e00;p=gitmo%2FMoose.git diff --git a/lib/Moose/Meta/Role/Application/ToInstance.pm b/lib/Moose/Meta/Role/Application/ToInstance.pm index 1d6ff7c..f44c024 100644 --- a/lib/Moose/Meta/Role/Application/ToInstance.pm +++ b/lib/Moose/Meta/Role/Application/ToInstance.pm @@ -6,7 +6,7 @@ use metaclass; use Scalar::Util 'blessed'; -our $VERSION = '0.62_02'; +our $VERSION = '0.93'; $VERSION = eval $VERSION; our $AUTHORITY = 'cpan:STEVAN'; @@ -29,7 +29,15 @@ sub apply { $class = $ANON_CLASSES{$anon_role_key}; } else { - my $obj_meta = eval { $object->meta } || 'Moose::Meta::Class'; + my $obj_meta = Class::MOP::class_of($object) || 'Moose::Meta::Class'; + + # This is a special case to handle the case where the object's + # metaclass is a Class::MOP::Class, but _not_ a Moose::Meta::Class + # (for example, when applying a role to a Moose::Meta::Attribute + # object). + $obj_meta = 'Moose::Meta::Class' + unless $obj_meta->isa('Moose::Meta::Class'); + $class = $obj_meta->create_anon_class( superclasses => [ blessed($object) ] ); @@ -68,9 +76,7 @@ Moose::Meta::Role::Application::ToInstance - Compose a role into an instance =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. +See L for details on reporting bugs. =head1 AUTHOR @@ -78,7 +84,7 @@ Stevan Little Estevan@iinteractive.comE =head1 COPYRIGHT AND LICENSE -Copyright 2006-2008 by Infinity Interactive, Inc. +Copyright 2006-2010 by Infinity Interactive, Inc. L