From: gfx Date: Thu, 8 Oct 2009 10:14:52 +0000 (+0900) Subject: Check superclasses not to inherit from roles X-Git-Tag: 0.37_04~10 X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=9d0686b20ef0bafe5f99c9a9c5e354ff06476f15;p=gitmo%2FMouse.git Check superclasses not to inherit from roles --- diff --git a/lib/Mouse/Meta/Class.pm b/lib/Mouse/Meta/Class.pm index ea36a4b..f418d6c 100644 --- a/lib/Mouse/Meta/Class.pm +++ b/lib/Mouse/Meta/Class.pm @@ -48,7 +48,13 @@ sub superclasses { my $self = shift; if (@_) { - Mouse::load_class($_) for @_; + foreach my $super(@_){ + Mouse::Util::load_class($super); + my $meta = Mouse::Util::get_metaclass_by_name($super); + if($meta && $meta->isa('Mouse::Meta::Role')){ + $self->throw_error("You cannot inherit from a Mouse Role ($super)"); + } + } @{ $self->{superclasses} } = @_; }