X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=blobdiff_plain;f=lib%2FMouse%2FMeta%2FAttribute.pm;h=dad65a8d5533ccbf57fcfc7b0b4a3711c05569c8;hb=7e2909e58c70dfb258ca1d10b334eaa6d8422852;hp=64d3d6eb7bff0c6a899f2d098344c1c912c7eee3;hpb=3cf68001150c7fa1e0f75dca6526a8507a0ae210;p=gitmo%2FMouse.git diff --git a/lib/Mouse/Meta/Attribute.pm b/lib/Mouse/Meta/Attribute.pm index 64d3d6e..dad65a8 100644 --- a/lib/Mouse/Meta/Attribute.pm +++ b/lib/Mouse/Meta/Attribute.pm @@ -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