Fix type_constraint always being set to undef
Shawn M Moore [Tue, 10 Jun 2008 02:08:50 +0000 (02:08 +0000)]
lib/Mouse/Attribute.pm

index 2076297..0bc6a20 100644 (file)
@@ -147,7 +147,8 @@ sub create {
     $args{handles} = { $self->_canonicalize_handles($args{handles}) }
         if $args{handles};
 
-    $args{type_constraint} = delete $args{isa};
+    $args{type_constraint} = delete $args{isa}
+        if exists $args{isa};
 
     my $attribute = $self->new(%args, name => $name, class => $class);
     my $meta = $class->meta;