Begin adding tests for has +foo
[gitmo/Mouse.git] / lib / Mouse / Meta / Attribute.pm
index 64d3d6e..dad65a8 100644 (file)
@@ -162,6 +162,14 @@ sub create {
         if ref($args{default})
         && ref($args{default}) ne 'CODE';
 
+    confess "You cannot auto-dereference without specifying a type constraint on attribute $name"
+        if $args{auto_deref} && !exists($args{isa});
+
+    confess "You cannot auto-dereference anything other than a ArrayRef or HashRef on attribute $name"
+        if $args{auto_deref}
+        && $args{isa} ne 'ArrayRef'
+        && $args{isa} ne 'HashRef';
+
     $args{type_constraint} = delete $args{isa}
         if exists $args{isa};
 
@@ -299,6 +307,8 @@ installed. Some error checking is done.
 
 =head2 has_builder -> Bool
 
+=head2 should_auto_deref -> Bool
+
 Informational methods.
 
 =head2 generate_accessor -> CODE