Skip to content

Commit

Permalink
Remove my hideous hack after autarch++ fixed Moose in cf600c8
Browse files Browse the repository at this point in the history
  • Loading branch information
bobtfish committed Feb 9, 2010
1 parent 77715eb commit 1208af0
Showing 1 changed file with 1 addition and 19 deletions.
20 changes: 1 addition & 19 deletions lib/MooseX/MethodAttributes/Role/Meta/Role/Application.pm
Expand Up @@ -48,25 +48,7 @@ sub _apply_metaclasses {
# into lies by the metatrait role application process, so we explicitly
# re-fetch it here.

# Alternatively, for epic shits and giggles, the meta trait application
# process (onto $thing) may have applied roles to our metaclass, but (if
# $thing is an anon class, not correctly replaced it in the metaclass cache.
# This results in the DESTROY method in Class::MOP::Class r(eap|ape)ing the
# package, which is unfortunate, as it removes all your methods and superclasses.
# Therefore, we avoid that by ramming the metaclass we've just been handed into
# the cache without weakening it.

# I'm fairly sure the 2nd part of that is a Moose bug, and should go away..
# Unfortunately, the implication of that is that whenever you apply roles to a class,
# the metaclass instance can change, and so needs to be re-retrieved or handed back
# to the caller :/
if ($thing->can('is_anon_class') and $thing->is_anon_class) {
Class::MOP::store_metaclass_by_name($thing->name, $thing);
}
else {
return find_meta($thing->name);
}
return $thing;
return find_meta($thing->name);
}

1;

0 comments on commit 1208af0

Please sign in to comment.