more strict argument check. Mouse does not support Application::ToInstance yet
Tokuhiro Matsuno [Thu, 2 Apr 2009 02:45:11 +0000 (11:45 +0900)]
lib/Mouse/Meta/Role.pm

index 6c5d32f..5dccbdc 100644 (file)
@@ -70,6 +70,7 @@ sub get_method_list {
     wantarray ? @functions : \@functions;
 }
 
+# Moose uses Application::ToInstance, Application::ToClass, Application::ToRole
 sub apply {
     my $self  = shift;
     my $selfname = $self->name;
@@ -77,6 +78,10 @@ sub apply {
     my $classname = $class->name;
     my %args  = @_;
 
+    if ($class->isa('Mouse::Object')) {
+        Carp::croak('Mouse does not support Application::ToInstance yet');
+    }
+
     if ($class->isa('Mouse::Meta::Class')) {
         for my $name (@{$self->{required_methods}}) {
             unless ($classname->can($name)) {